public class StepVerifierOptions extends Object
StepVerifier
, including the initial request amount,
VirtualTimeScheduler
supplier and toggles for some checks.Modifier and Type | Method and Description |
---|---|
StepVerifierOptions |
checkUnderRequesting(boolean enabled)
Activate or deactivate the
StepVerifier check of request amount
being too low. |
static StepVerifierOptions |
create()
Create a new default set of options for a
StepVerifier that can be tuned
using the various available non-getter methods (which can be chained). |
Context |
getInitialContext() |
long |
getInitialRequest() |
String |
getScenarioName() |
Supplier<? extends VirtualTimeScheduler> |
getVirtualTimeSchedulerSupplier() |
StepVerifierOptions |
initialRequest(long initialRequest)
Set the amount the
StepVerifier should request initially. |
boolean |
isCheckUnderRequesting() |
StepVerifierOptions |
scenarioName(String scenarioName)
Give a name to the whole scenario tested by the configured
StepVerifier . |
StepVerifierOptions |
virtualTimeSchedulerSupplier(Supplier<? extends VirtualTimeScheduler> vtsLookup)
Set a supplier for a
VirtualTimeScheduler , which is mandatory for a
StepVerifier to work with virtual time. |
StepVerifierOptions |
withInitialContext(Context context)
Set an initial
Context to be propagated by the StepVerifier when it
subscribes to the sequence under test. |
public static StepVerifierOptions create()
StepVerifier
that can be tuned
using the various available non-getter methods (which can be chained).public StepVerifierOptions checkUnderRequesting(boolean enabled)
StepVerifier
check of request amount
being too low. Defauts to true.enabled
- true if the check should be enabled.public boolean isCheckUnderRequesting()
StepVerifier
receiving these options should activate
the check of request amount being too low.public StepVerifierOptions initialRequest(long initialRequest)
StepVerifier
should request initially. Defaults to
unbounded request (Long.MAX_VALUE
).initialRequest
- the initial request amount.public long getInitialRequest()
StepVerifier
receiving these options.public StepVerifierOptions virtualTimeSchedulerSupplier(Supplier<? extends VirtualTimeScheduler> vtsLookup)
VirtualTimeScheduler
, which is mandatory for a
StepVerifier
to work with virtual time. Defaults to null.vtsLookup
- the supplier of VirtualTimeScheduler
to use.@Nullable public Supplier<? extends VirtualTimeScheduler> getVirtualTimeSchedulerSupplier()
VirtualTimeScheduler
to be used by the
StepVerifier
receiving these options.public StepVerifierOptions withInitialContext(Context context)
Context
to be propagated by the StepVerifier
when it
subscribes to the sequence under test.context
- the Context
to propagate.@Nullable public Context getInitialContext()
Context
to be propagated initially by the StepVerifier
.public StepVerifierOptions scenarioName(@Nullable String scenarioName)
StepVerifier
. That
name would be mentioned in exceptions and assertion errors raised by the StepVerifier,
allowing to better distinguish error sources in unit tests where multiple StepVerifier
are used.scenarioName
- the name of the scenario, null to deactivate@Nullable public String getScenarioName()
StepVerifier
, or null if none.