public static interface StepVerifier.LastStep
Modifier and Type | Method and Description |
---|---|
StepVerifier |
consumeErrorWith(Consumer<Throwable> consumer)
Expect an error and consume with the given consumer.
|
StepVerifier |
expectComplete()
Expect the completion signal.
|
StepVerifier |
expectError()
Expect an unspecified error.
|
StepVerifier |
expectError(Class<? extends Throwable> clazz)
Expect an error of the specified type.
|
StepVerifier |
expectErrorMatches(Predicate<Throwable> predicate)
Expect an error and evaluate with the given predicate.
|
StepVerifier |
expectErrorMessage(String errorMessage)
Expect an error with the specified message.
|
StepVerifier |
expectErrorSatisfies(Consumer<Throwable> assertionConsumer)
Expect an error and assert it via assertion(s) provided as a
Consumer . |
StepVerifier |
expectTimeout(Duration duration)
|
StepVerifier |
thenCancel()
Cancel the underlying subscription.
|
Duration |
verifyComplete()
Trigger the
verification , expecting a completion signal
as terminal event. |
Duration |
verifyError()
Trigger the
verification , expecting an unspecified error
as terminal event. |
Duration |
verifyError(Class<? extends Throwable> clazz)
Trigger the
verification , expecting an error of the specified
type as terminal event. |
Duration |
verifyErrorMatches(Predicate<Throwable> predicate)
Trigger the
verification , expecting an error that matches
the given predicate as terminal event. |
Duration |
verifyErrorMessage(String errorMessage)
Trigger the
verification , expecting an error with the
specified message as terminal event. |
Duration |
verifyErrorSatisfies(Consumer<Throwable> assertionConsumer)
Trigger the
verification , expecting an error as terminal event
which gets asserted via assertion(s) provided as a Consumer . |
default Duration |
verifyTimeout(Duration duration)
Trigger the
verification , expecting that the Publisher
under test doesn't terminate but rather times out after the provided Duration . |
StepVerifier consumeErrorWith(Consumer<Throwable> consumer)
AssertionError
s thrown by the consumer will be rethrown
during verification.consumer
- the consumer for the exceptionStepVerifier expectError()
Subscriber.onError(Throwable)
StepVerifier expectError(Class<? extends Throwable> clazz)
clazz
- the expected error typeSubscriber.onError(Throwable)
StepVerifier expectErrorMessage(String errorMessage)
errorMessage
- the expected error messageSubscriber.onError(Throwable)
StepVerifier expectErrorMatches(Predicate<Throwable> predicate)
predicate
- the predicate to test on the next received errorSubscriber.onError(Throwable)
StepVerifier expectErrorSatisfies(Consumer<Throwable> assertionConsumer)
Consumer
.
Any AssertionError
thrown by the consumer has its message propagated
through a new StepVerifier-specific AssertionError.assertionConsumer
- the consumer that applies assertion(s) on the next received errorSubscriber.onError(Throwable)
StepVerifier expectTimeout(Duration duration)
Publisher
under test doesn't terminate but
rather times out after the provided Duration
(a timeout implying
a cancellation of the source).
This is equivalent to appending the timeout
operator to the publisher and expecting a TimeoutException
onError signal
, while also triggering a wait
to ensure unexpected signals are detected.
duration
- the Duration
for which no new event is expectedStepVerifier expectComplete()
Subscriber.onComplete()
StepVerifier thenCancel()
Note that time-manipulating operators like StepVerifier.Step.expectNoEvent(Duration)
are detected and waited for before cancellation occurs.
Subscription.cancel()
Duration verifyError()
verification
, 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).
Duration
the verification took.expectError()
,
StepVerifier.verify()
,
Subscriber.onError(Throwable)
Duration verifyError(Class<? extends Throwable> clazz)
verification
, 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).
clazz
- the expected error typeDuration
the verification took.expectError(Class)
,
StepVerifier.verify()
,
Subscriber.onError(Throwable)
Duration verifyErrorMessage(String errorMessage)
verification
, 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).
errorMessage
- the expected error messageDuration
the verification took.expectErrorMessage(String)
,
StepVerifier.verify()
,
Subscriber.onError(Throwable)
Duration verifyErrorMatches(Predicate<Throwable> predicate)
verification
, 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).
predicate
- the predicate to test on the next received errorDuration
the verification took.expectErrorMatches(Predicate)
,
StepVerifier.verify()
,
Subscriber.onError(Throwable)
default Duration verifyTimeout(Duration duration)
verification
, expecting that the Publisher
under test doesn't terminate but rather times out after the provided Duration
.
A timeout implies a cancellation of the source.
This is a convenience method that calls StepVerifier.verify()
in addition to expectTimeout(Duration)
.
The later is equivalent to appending the timeout
operator to the publisher and expecting a TimeoutException
onError signal
, while also triggering a wait
to ensure unexpected signals are detected.
duration
- the Duration
for which no new event is expectedDuration
the verification took.expectTimeout(Duration)
,
StepVerifier.verify()
Duration verifyErrorSatisfies(Consumer<Throwable> assertionConsumer)
verification
, expecting an error as terminal event
which gets asserted via assertion(s) provided as a Consumer
.
Any AssertionError
thrown 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).
assertionConsumer
- the consumer that applies assertion(s) on the next received errorDuration
the verification took.expectErrorSatisfies(Consumer)
,
StepVerifier.verify()
,
Subscriber.onError(Throwable)
Duration verifyComplete()
verification
, 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).
Duration
the verification took.expectComplete()
,
StepVerifier.verify()
,
Subscriber.onComplete()