Package net.jqwik.api.state
Schnittstelle Action<S extends @Nullable Object>
- Typparameter:
S
- Type of the object to transform through an action
- Alle bekannten Unterschnittstellen:
Action.Dependent<S>
,Action.Independent<S>
- Alle bekannten Implementierungsklassen:
Action.JustMutate
,Action.JustTransform
An action class represents a state transformation that can be performed
on an object of type
S
.
Those objects can be mutable, which means that the state changing method will return the same object,
or immutable, which requires the method to return another object that represents the transformed state.
Do not implement this interface directly, but either Action.Dependent or Action.Independent. Only those can be used to create an arbitrary for a ActionChain.
Mind that there is a another interface Action
which looks similar
but refers to jqwik's old and deprecated style of state-based property testing.
The two interfaces CANNOT be used interchangeably.
- Siehe auch:
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypSchnittstelleBeschreibungstatic interface
Action.Dependent<S extends @Nullable Object>
Implement this interface if you want to have the action's transforming behaviour depend on the previous state.static interface
Action.Independent<S extends @Nullable Object>
Implement this interface if you want to have the action's transforming behaviour not to depend on previous state.static class
Action.JustMutate<S extends @Nullable Object>
Subclass if you want to implement an independent action that simply mutates the given state.static class
Action.JustTransform<S extends @Nullable Object>
Subclass if you want to implement an independent action that simply transforms the given state. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T extends @Nullable Object>
ActionBuilder<T> builder()
Create an unconditioned ActionBuilder.static <T extends @Nullable Object>
Action.Independent<T> just
(String description, Transformer<T> transformer) Convenience method to create an independent Action with a description and a constant transformerstatic <T extends @Nullable Object>
Action.Independent<T> just
(Transformer<T> transformer) Convenience method to create an independent Action with a constant transformerdefault boolean
precondition
(S state) If this method returns false, the action will not be performed.static <T extends @Nullable Object>
ActionBuilder<T> Create an ActionBuilder with a precondition.
-
Methodendetails
-
builder
Create an unconditioned ActionBuilder. -
when
Create an ActionBuilder with a precondition. -
just
Convenience method to create an independent Action with a constant transformer -
just
static <T extends @Nullable Object> Action.Independent<T> just(String description, Transformer<T> transformer) Convenience method to create an independent Action with a description and a constant transformer -
precondition
If this method returns false, the action will not be performed.Implementing this method will make the chain of actions harder to shrink.
- Parameter:
state
- the current state- Gibt zurück:
- true if the precondition holds
-