Skip to content

Commit

Permalink
Extend StepVerifierLastStepVerifyErrorClass Refaster rule (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
Venorcis authored Oct 8, 2023
1 parent da5eea8 commit ffe4db2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,7 @@ static final class StepVerifierLastStepVerifyErrorClass<T extends Throwable> {
Duration before(StepVerifier.LastStep step, Class<T> clazz) {
return Refaster.anyOf(
step.expectError(clazz).verify(),
step.verifyErrorMatches(clazz::isInstance),
step.verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(clazz)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,9 @@ ImmutableSet<Duration> testStepVerifierLastStepVerifyErrorClass() {
return ImmutableSet.of(
StepVerifier.create(Mono.empty()).expectError(IllegalArgumentException.class).verify(),
StepVerifier.create(Mono.empty())
.verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(IllegalStateException.class)));
.verifyErrorMatches(IllegalStateException.class::isInstance),
StepVerifier.create(Mono.empty())
.verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(AssertionError.class)));
}

Duration testStepVerifierLastStepVerifyErrorMatches() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ Duration testStepVerifierLastStepVerifyError() {
ImmutableSet<Duration> testStepVerifierLastStepVerifyErrorClass() {
return ImmutableSet.of(
StepVerifier.create(Mono.empty()).verifyError(IllegalArgumentException.class),
StepVerifier.create(Mono.empty()).verifyError(IllegalStateException.class));
StepVerifier.create(Mono.empty()).verifyError(IllegalStateException.class),
StepVerifier.create(Mono.empty()).verifyError(AssertionError.class));
}

Duration testStepVerifierLastStepVerifyErrorMatches() {
Expand Down

0 comments on commit ffe4db2

Please sign in to comment.