public class StepVerifierOptions
extends java.lang.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. |
StepVerifierOptions |
copy()
Make a copy of this
StepVerifierOptions instance. |
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). |
<T> StepVerifierOptions |
extractor(ValueFormatters.Extractor<T> extractor)
Add an
ValueFormatters.Extractor, replacing any existing ValueFormatters.Extractor that targets the
same Class (as in ValueFormatters.Extractor.getTargetClass()). |
java.util.Collection<ValueFormatters.Extractor<?>> |
getExtractors()
Get the list of value extractors added to the options, including default ones at
the end (unless they've been individually replaced).
|
@Nullable Context |
getInitialContext() |
long |
getInitialRequest() |
@Nullable java.lang.String |
getScenarioName() |
@Nullable ValueFormatters.ToStringConverter |
getValueFormatter()
Get the custom object formatter to use when producing messages.
|
@Nullable java.util.function.Supplier<? extends VirtualTimeScheduler> |
getVirtualTimeSchedulerSupplier() |
StepVerifierOptions |
initialRequest(long initialRequest)
Set the amount the
StepVerifier should request initially. |
boolean |
isCheckUnderRequesting() |
StepVerifierOptions |
scenarioName(@Nullable java.lang.String scenarioName)
Give a name to the whole scenario tested by the configured
StepVerifier. |
StepVerifierOptions |
valueFormatter(@Nullable ValueFormatters.ToStringConverter valueFormatter)
Set up a custom value formatter to be used in error messages when presenting
expected and actual values.
|
StepVerifierOptions |
virtualTimeSchedulerSupplier(java.util.function.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 copy()
StepVerifierOptions instance.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 valueFormatter(@Nullable ValueFormatters.ToStringConverter valueFormatter)
Object.toString()
implementation that cannot be overridden.
This is a Function capable of formatting an arbitrary Object to
String, with the intention of detecting elements from the sequence under
test and applying customized String conversion to them (and simply calling
Object.toString() on other objects).
See ValueFormatters for factories of such functions.
valueFormatter - the custom value to String formatter, or null to deactivate
custom formattingpublic @Nullable ValueFormatters.ToStringConverter getValueFormatter()
Object, usually filtering types matching
the content of the sequence under test, and applying a simple String conversion
on other objects.public <T> StepVerifierOptions extractor(ValueFormatters.Extractor<T> extractor)
ValueFormatters.Extractor, replacing any existing ValueFormatters.Extractor that targets the
same Class (as in ValueFormatters.Extractor.getTargetClass()).
Note that by default, default extractors for Signal,
Iterable and
Object[] are in place.
T - the type of container considered by this extractorextractor - the extractor to add / setpublic java.util.Collection<ValueFormatters.Extractor<?>> getExtractors()
The Collection is a copy, and mutating the collection doesn't mutate the
configured extractors in this StepVerifierOptions.
ValueFormatters.Extractorpublic StepVerifierOptions virtualTimeSchedulerSupplier(java.util.function.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.public @Nullable java.util.function.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.public @Nullable Context getInitialContext()
Context to be propagated initially by the StepVerifier.public StepVerifierOptions scenarioName(@Nullable java.lang.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 deactivatepublic @Nullable java.lang.String getScenarioName()
StepVerifier, or null if none.