VirtualTimeScheduler
's present time.VirtualTimeScheduler
's clock forward by a specified amount of time.VirtualTimeScheduler
's clock to a particular moment in time.ValueFormatters.ToStringConverter
, if the object passes
the ValueFormatters.Extractor.test(Object)
, extract elements from it and convert them using the
ValueFormatters.ToStringConverter
, joining the result together to obtain a customized
String
representation of both the container and its contents.[CONVERTED1, CONVERTED2]
representation.n
.n
.Context
.AssertionError
.AssertionError
.AssertionError
.AssertionError
.AssertionError
.AssertionError
.Duration
has elapsed.TestSubscriber
according to this builder.Fuseable.ConditionalSubscriber
variant of TestSubscriber
according
to this builder.TestSubscriber
with tuning.Publisher
and
unblock any pending TestSubscriber.block()
calls.StepVerifier
check of request amount
being too low.completion
of this publisher.Fuseable.ConditionalSubscriber
variant of the
TestSubscriber
.AssertionError
s thrown by the consumer will be rethrown during verification.StepVerifier.Step.recordWith(java.util.function.Supplier<? extends java.util.Collection<T>>)
, end it and verify
it by applying the given consumer.Subscription
and consume with the given consumer.Context
contains the given value associated
to the given key.Context
with a single entry.Context
by putting all entries of the given ContextView
in it.StepVerifierOptions
instance.TestPublisher
.VirtualTimeScheduler
without enabling it.VirtualTimeScheduler
without enabling it.StepVerifier
in an uncontrolled environment:
StepVerifier.Step.thenAwait()
will block in real time.StepVerifier
in an uncontrolled environment:
StepVerifier.Step.thenAwait()
will block in real time.StepVerifier
in an uncontrolled environment:
StepVerifier.Step.thenAwait()
will block in real time.StepVerifier
that can be tuned
using the various available non-getter methods (which can be chained).TestSubscriber
which will make an unbounded demand on subscription
,
has an empty Context
and makes no attempt at fusion negotiation.TestPublisher
, which can be subscribed to by multiple
subscribers.TestPublisher
, which can be subscribed to by multiple
subscribers.TestPublisher
, which can be subscribed to by multiple
subscribers.noncompliant
hot TestPublisher
with a given set of reactive streams spec violations that will be overlooked.StepVerifier.verify()
) is "no timeout".LoggerUtils.enableCaptureWith(Logger)
.Duration
ValueFormatters.ToStringConverter
that removes the PT prefix and
switches to lower case
.PublisherProbe
of which PublisherProbe.flux()
and PublisherProbe.mono()
versions will simply complete, capturing subscription, cancellation and request
events around them.Predicate
that will turn this StepVerifier's subscribers into
Fuseable.ConditionalSubscriber
and drive the Fuseable.ConditionalSubscriber.tryOnNext(Object)
behavior of these subscribers.error
signal to the subscribers.Subscription
step, a Context
has been
propagated.Consumer
.Publisher
to run with Reactor Fusion flow
optimization.Publisher
to run the requested Reactor Fusion mode
from any of these modes :
Fuseable.NONE
, Fuseable.SYNC
, Fuseable.ASYNC
,
Fuseable.ANY
, Fuseable.THREAD_BARRIER
.Publisher
to run with Reactor Fusion flow
optimization.count
elements, starting from the previous
expectation or onSubscribe.Iterable
until its
iterator depletes.Context
was propagated after the Subscription
phase, which usually indicates that the sequence under test doesn't contain
Reactor operators (i.e.Duration
.Publisher
to NOT run with Reactor Fusion flow
optimization.StepVerifier.Step.recordWith(java.util.function.Supplier<? extends java.util.Collection<T>>)
, end it and verify
it by ensuring the provided predicate matches.Subscription
.Subscription
and evaluate with the given predicate.TestSubscriber
to be terminated
with an Subscriber.onError(Throwable)
and return the terminating Throwable
if so.Stream
of Object
, each of which
is a candidate for individual String
conversion by a ValueFormatters.ToStringConverter
when applied as a BiFunction
.ValueFormatters.Extractor
, replacing any existing ValueFormatters.Extractor
that targets the
same Class
(as in ValueFormatters.Extractor.getTargetClass()
).Flux
version of the probe.TestPublisher
to a Flux
.VirtualTimeScheduler
assigned in Schedulers
int
code that represents the negotiated fusion mode for this TestSubscriber
.VirtualTimeScheduler
to all Schedulers.Factory
factories ONLY if no VirtualTimeScheduler
is currently set.VirtualTimeScheduler
to all Schedulers.Factory
factories ONLY if no VirtualTimeScheduler
is currently set.VirtualTimeScheduler
to the relevant
Schedulers.Factory
factories, depending on how it was created (see
VirtualTimeScheduler.create()
and VirtualTimeScheduler.create()
).List
of Signal
which represent detected protocol error from the source Publisher
,
that is to say signals that were emitted to this TestSubscriber
in violation of the Reactive Streams
specification.List
of all elements that have correctly been emitted to the TestSubscriber
(onNext signals)
so far.List
of elements that have been emitted to the TestSubscriber
(onNext signals) so far,
after a TestSubscriber.cancel()
was triggered.Class
.discard
hook, in any order.discard
hook.discard
hook,
and check that the collection of discarded elements matches a predicate.discard
hook, and assert them as a collection.discard
hook,
in any order, and that no other elements were dropped.Hooks.onNextDropped(Consumer)
hook, in any order.Hooks.onNextDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook, and check that the collection of
errors matches a predicate.Hooks.onErrorDropped(Consumer)
hook, and assert them as a collection.Hooks.onErrorDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.Hooks.onNextDropped(Consumer)
hook, in any order, and that no
other elements were dropped.Context
contains a value for the given key.discard
hook.Hooks.onNextDropped(Consumer)
hook.Hooks.onErrorDropped(Consumer)
hook.onOperatorError
hook
exactly once and the error matches the given predicate.onOperatorError
hook
exactly once and the error is of the given type.onOperatorError
hook
at least once.onOperatorError
hook
exactly n times.onOperatorError
hook
once or more, and check that the collection of errors and their optionally
associated data matches a predicate.onOperatorError
hook
once or more, and assert the errors and optionally associated data as a collection.onOperatorError
hook
exactly once and the error has the exact provided message.onOperatorError
hook
exactly once, with the error message containing the provided string.Context
is of the given size.StepVerifier
should request initially.Subscription
in Subscriber.onSubscribe(Subscription)
.Subscription
in Subscriber.onSubscribe(Subscription)
to be an
unbounded request, ie.TestSubscriber
has been cancelled
, which implies TestSubscriber.isTerminatedOrCancelled()
is also true.VirtualTimeScheduler
currently used by the
Schedulers
factory (ie it has been enabled
),
false otherwise (ie it has been reset
).TestSubscriber
has received a terminal signal, ie.TestSubscriber
has received a terminal signal that is specifically onComplete.TestSubscriber
has received a terminal signal that is specifically onError.TestSubscriber
has either:
been cancelled: TestSubscriber.isCancelled()
would return true
been terminated, having been signalled with onComplete or onError: TestSubscriber.isTerminated()
would return true and TestSubscriber.getTerminalSignal()
would return a non-null Signal
The third possible failure condition, subscription failure, results in an AssertionError
being thrown by this method
(like all other accessors, see also TestSubscriber
javadoc).Iterable
extractor that use the [CONVERTED1, CONVERTED2]
representation.loggers
.Mono
version of the probe.TestPublisher
to a Mono
.onNext
signal to the subscribers.onNext
signals to the subscribers.PublisherProbe
out of a Publisher
, ensuring that its
PublisherProbe.flux()
and PublisherProbe.mono()
versions will propagate signals from this
publisher while capturing subscription, cancellation and request events around it.String
representation, given
the original container.Runnable
s as much as possible
to test race conditions.Runnable
s as much as possible
to test race conditions.RaceTestUtils.race(Scheduler, Runnable...)
. To be removed in 3.6.0, at the earliest.Runnable
s as much as possible
to test race conditions.Runnable
s as much as possible
to test race conditions.Publishers
.Schedulers
.Subscribers
.Subscriber.onNext(Object)
values in
the supplied Collection
.TestSubscriber
, with Fuseable.NONE
) being a special case.TestSubscriber
, with both parameters set to Fuseable.NONE
being a special case.Schedulers
and potentially customized
Schedulers.Factory
that were
active prior to last activation of VirtualTimeScheduler
factories.StepVerifier.verify()
timeout to the "unlimited" default.StepVerifier
.VirtualTimeScheduler
to the relevant
Schedulers.Factory
factories, depending on how it was created (see
VirtualTimeScheduler.create()
and VirtualTimeScheduler.create()
).StepVerifier.verify()
timeout for all StepVerifier
created through the
factory methods (StepVerifier.create(Publisher)
, StepVerifier.withVirtualTime(Supplier)
, etc.).StepVerifier
provides a declarative way of creating a verifiable script for
an async Publisher
sequence, by expressing expectations about the events that
will happen upon subscription.Context
propagated during the Subscription
phase.Subscription
as
first signal.StepVerifier
, including the initial request amount,
VirtualTimeScheduler
supplier and toggles for some checks.String
representation, given
the original container.ValueFormatters.Extractor
.Logger
that writes to ByteArrayOutputStream
and allows retrieval of
the logs via TestLogger.getErrContent()
and TestLogger.getOutContent()
.Publisher
that you can directly manipulate, triggering
onNext
, onComplete
and
onError
events, for testing purposes.TestPublisher
.CoreSubscriber
that can be attached to any Publisher
to later assert which
events occurred at runtime.TestSubscriber
, also
allowing for a Fuseable.ConditionalSubscriber
variant.StepVerifier.ContextExpectations
as a
StepVerifier
expectation, and return the current StepVerifier.Step
in order
to build further sequence expectations and ultimately verify
the sequence.Duration
.Publisher
.logger factory
that will return loggers that not only use the
original logging framework used by reactor, but also use the logger set via LoggerUtils.enableCaptureWith(Logger)
, irrespective
of its name or how it was obtained.ValueFormatters.ToStringConverter
Function
that convert objects to String
.BiFunction
aiming at producing a customized String
representation of a container type and its contained elements, each element being
potentially itself converted to String
using a ValueFormatters.ToStringConverter
:
it only considers specific container types, see ValueFormatters.Extractor.getTargetClass()
it can further filter these container instances using ValueFormatters.Extractor.matches(Object)
it can be applied to arbitrary objects, as it will default to String.valueOf(Object)
on non-matching containers
it can apply a ValueFormatters.ToStringConverter
to the content, passed as the second
parameter of the BiFunction
it reconstructs the String
representation of the container by
exploding
it and then joining
it with {#code ", "} delimiter, as well as custom ValueFormatters.Extractor.prefix(Object)
and ValueFormatters.Extractor.suffix(Object)
verification
, expecting a completion signal
as terminal event.verification
, expecting an unspecified error
as terminal event.verification
, expecting an error of the specified
type as terminal event.verification
, expecting an error that matches
the given predicate as terminal event.verification
, expecting an error with the
specified message as terminal event.verification
, expecting an error as terminal event
which gets asserted via assertion(s) provided as a Consumer
.Verifies
the signals received by this subscriber, then exposes
various assertion methods
on the final state.Verifies
the signals received by this subscriber, then exposes
various assertion methods
on the final state.verification
, expecting that the Publisher
under test doesn't terminate but rather times out after the provided Duration
.Scheduler
that uses a virtual clock, allowing to manipulate time
(eg.VirtualTimeScheduler
, which is mandatory for a
StepVerifier
to work with virtual time.Context
to be propagated by the StepVerifier
when it
subscribes to the sequence under test.StepVerifier
in a controlled environment using
VirtualTimeScheduler
to manipulate a virtual clock via
StepVerifier.Step.thenAwait()
.StepVerifier
in a controlled environment using
VirtualTimeScheduler
to manipulate a virtual clock via
StepVerifier.Step.thenAwait()
.StepVerifier
in a controlled environment using
a user-provided VirtualTimeScheduler
to manipulate a virtual clock via
StepVerifier.Step.thenAwait()
.StepVerifier
in a controlled environment using
a user-provided VirtualTimeScheduler
to manipulate a virtual clock via
StepVerifier.Step.thenAwait()
.