Package net.jqwik.api.state
Schnittstelle ActionChain<S extends @Nullable Object>
- Typparameter:
S
- The type of the object going through state transformations
A chain of transforming Actions that can be run for values of type
S
.
Since the next action is usually created on demand, the current runState
of a chain can be queried.
By default any action chain instance is not thread safe, i.e. you should not try to invoke run() concurrently.
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypSchnittstelleBeschreibungstatic class
static enum
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungThe final state value after running an action chain.Observe the state transformations of a running chain by adding a peeker to an action chain.run()
Run the list through all transformations provided by the actions to create it.running()
An action chain can be in different running states: NOT_RUN, RUNNING, FAILED, SUCEEDEDstatic <T extends @Nullable Object>
ActionChainArbitrary<T> Create arbitrary for a chain with a certain initial state.Return list of all applied transformations.List
<Transformer<S>> Return list of all used transformer instances.withInvariant
(@Nullable String label, Consumer<S> invariant) Add a labelled invariant to a sequence.default ActionChain
<S> withInvariant
(Consumer<S> invariant) Add an unlabelled invariant to a sequence.
-
Methodendetails
-
startWith
static <T extends @Nullable Object> ActionChainArbitrary<T> startWith(Supplier<? extends T> initialSupplier) Create arbitrary for a chain with a certain initial state.- Typparameter:
T
- The type of state to be transformed through the chain.- Parameter:
initialSupplier
- function to create the initial state object- Gibt zurück:
- new arbitrary instance
-
transformations
Return list of all applied transformations.For a chain that has not been run this list is always empty.
- Gibt zurück:
- list of describing strings
-
transformers
Return list of all used transformer instances.Checking transformer instances - e.g. if they are of a certain implementation type - only makes sense if the transformer's description string is NOT set explicitly, e.g. in an Action's description() method.
For a chain that has not been run this list is always empty.
- Gibt zurück:
- list of transformer instances
-
run
S run()Run the list through all transformations provided by the actions to create it. Stop when either the maximum number of transformations is reached or if a Transformer.END_OF_CHAIN is being applied.- Gibt zurück:
- the last resulting state of running through transformations
-
withInvariant
Add an unlabelled invariant to a sequence.- Parameter:
invariant
- will be checked after each successful action- Gibt zurück:
- the same chain instance
- Siehe auch:
-
withInvariant
Add a labelled invariant to a sequence.- Parameter:
label
- will show up in error messages when the invariant failsinvariant
- will be checked after each successful action- Gibt zurück:
- the same chain instance
- Siehe auch:
-
finalState
The final state value after running an action chain.- Gibt zurück:
- state or Optional.empty() if chain has not been run
-
running
ActionChain.RunningState running()An action chain can be in different running states: NOT_RUN, RUNNING, FAILED, SUCEEDED- Gibt zurück:
- a state object
-
peek
Observe the state transformations of a running chain by adding a peeker to an action chain. Thepeeker
will be called after each successful transformation but before checking invariants.There can be more than one peeker.
- Parameter:
peeker
- A consumer of a state object- Gibt zurück:
- the same chain instance
-