Interface StepVerifier.LastStep
- All Known Subinterfaces:
StepVerifier.FirstStep<T>,StepVerifier.Step<T>
- Enclosing interface:
- StepVerifier
-
Method Summary
Modifier and TypeMethodDescriptionconsumeErrorWith(Consumer<Throwable> consumer) Expect an error and consume with the given consumer.Expect the completion signal.Expect an unspecified error.expectError(Class<? extends Throwable> clazz) Expect an error of the specified type.expectErrorMatches(Predicate<Throwable> predicate) Expect an error and evaluate with the given predicate.expectErrorMessage(String errorMessage) Expect an error with the specified message.expectErrorSatisfies(Consumer<Throwable> assertionConsumer) Expect an error and assert it via assertion(s) provided as aConsumer.expectTimeout(Duration duration) Cancel the underlying subscription.Trigger theverification, expecting a completion signal as terminal event.Trigger theverification, expecting an unspecified error as terminal event.verifyError(Class<? extends Throwable> clazz) Trigger theverification, expecting an error of the specified type as terminal event.verifyErrorMatches(Predicate<Throwable> predicate) Trigger theverification, expecting an error that matches the given predicate as terminal event.verifyErrorMessage(String errorMessage) Trigger theverification, expecting an error with the specified message as terminal event.verifyErrorSatisfies(Consumer<Throwable> assertionConsumer) Trigger theverification, expecting an error as terminal event which gets asserted via assertion(s) provided as aConsumer.default DurationverifyTimeout(Duration duration) Trigger theverification, expecting that thePublisherunder test doesn't terminate but rather times out after the providedDuration.
-
Method Details
-
consumeErrorWith
Expect an error and consume with the given consumer. AnyAssertionErrors thrown by the consumer will be rethrown during verification.- Parameters:
consumer- the consumer for the exception- Returns:
- the built verification
-
expectError
StepVerifier expectError()Expect an unspecified error.- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
expectError
Expect an error of the specified type.- Parameters:
clazz- the expected error type- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
expectErrorMessage
Expect an error with the specified message.- Parameters:
errorMessage- the expected error message- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
expectErrorMatches
Expect an error and evaluate with the given predicate.- Parameters:
predicate- the predicate to test on the next received error- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
expectErrorSatisfies
Expect an error and assert it via assertion(s) provided as aConsumer. AnyAssertionErrorthrown by the consumer has its message propagated through a new StepVerifier-specific AssertionError.- Parameters:
assertionConsumer- the consumer that applies assertion(s) on the next received error- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
expectTimeout
Verify that thePublisherunder test doesn't terminate but rather times out after the providedDuration(a timeout implying a cancellation of the source).This is equivalent to appending the
timeoutoperator to the publisher and expecting aTimeoutExceptiononError signal, while also triggering awaitto ensure unexpected signals are detected.- Parameters:
duration- theDurationfor which no new event is expected- Returns:
- the built verification scenario, ready to be verified
-
expectComplete
StepVerifier expectComplete()Expect the completion signal.- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
thenCancel
StepVerifier thenCancel()Cancel the underlying subscription. This happens sequentially after the previous step.Note that time-manipulating operators like
StepVerifier.Step.expectNoEvent(Duration)are detected and waited for before cancellation occurs.- Returns:
- the built verification scenario, ready to be verified
- See Also:
-
verifyError
Duration verifyError()Trigger theverification, expecting an unspecified error as terminal event.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Returns:
- the actual
Durationthe verification took. - See Also:
-
verifyError
Trigger theverification, expecting an error of the specified type as terminal event.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Parameters:
clazz- the expected error type- Returns:
- the actual
Durationthe verification took. - See Also:
-
verifyErrorMessage
Trigger theverification, expecting an error with the specified message as terminal event.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Parameters:
errorMessage- the expected error message- Returns:
- the actual
Durationthe verification took. - See Also:
-
verifyErrorMatches
Trigger theverification, expecting an error that matches the given predicate as terminal event.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Parameters:
predicate- the predicate to test on the next received error- Returns:
- the actual
Durationthe verification took. - See Also:
-
verifyTimeout
Trigger theverification, expecting that thePublisherunder test doesn't terminate but rather times out after the providedDuration. A timeout implies a cancellation of the source.This is a convenience method that calls
StepVerifier.verify()in addition toexpectTimeout(Duration). The later is equivalent to appending thetimeoutoperator to the publisher and expecting aTimeoutExceptiononError signal, while also triggering awaitto ensure unexpected signals are detected. -
verifyErrorSatisfies
Trigger theverification, expecting an error as terminal event which gets asserted via assertion(s) provided as aConsumer. AnyAssertionErrorthrown by the consumer has its message propagated through a new StepVerifier-specific AssertionError.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Parameters:
assertionConsumer- the consumer that applies assertion(s) on the next received error- Returns:
- the actual
Durationthe verification took. - See Also:
-
verifyComplete
Duration verifyComplete()Trigger theverification, expecting a completion signal as terminal event.This is a convenience method that calls
StepVerifier.verify()in addition to the expectation. Explicitly use the expect method and verification method separately if you need something more specific (like activating logging or changing the default timeout).- Returns:
- the actual
Durationthe verification took. - See Also:
-