Package net.jqwik.api.lifecycle
Interface AroundTryHook
-
- All Superinterfaces:
LifecycleHook
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@API(status=EXPERIMENTAL, since="1.2.3") @FunctionalInterface public interface AroundTryHook extends LifecycleHook
Implement this hook to define behaviour that should "wrap" the execution of a single try, i.e., do something directly before or after executing a property method with a given list of parameters. You can even change the result of a try from satisfied to falsified or the other way round.
-
-
Field Summary
Fields Modifier and Type Field Description static AroundTryHook
BASE
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TryExecutionResult
aroundTry(TryLifecycleContext context, TryExecutor aTry, java.util.List<java.lang.Object> parameters)
When you wrap a try you can do stuff before and/or after its execution.default int
aroundTryProximity()
The higher the value, the closer to the actual property method.default int
compareTo(AroundTryHook other)
-
Methods inherited from interface net.jqwik.api.lifecycle.LifecycleHook
appliesTo, propagateTo
-
-
-
-
Field Detail
-
BASE
@API(status=INTERNAL) static final AroundTryHook BASE
-
-
Method Detail
-
aroundTry
TryExecutionResult aroundTry(TryLifecycleContext context, TryExecutor aTry, java.util.List<java.lang.Object> parameters) throws java.lang.Throwable
When you wrap a try you can do stuff before and/or after its execution. All implementors should invoke the try withaTry.execute(parameters)
and either return the result of this call or create another result.It is possible to manipulate the
parameters
before invokingaTry.execute(parameters)
. Never change the number and types of parameters because this will result in runtime errors. Also keep in mind that all manipulation might mess up random generation and shrinking.- Parameters:
context
- The property's context objectaTry
- executor to callparameters
- the generated parameters for this try- Returns:
- result of running a single try
- Throws:
java.lang.Throwable
-
aroundTryProximity
default int aroundTryProximity()
The higher the value, the closer to the actual property method. Default value is 0.Values greater than -10 will make it run "inside" annotated lifecycle methods (BeforeTry and AfterTry).
- Returns:
- an integer value
-
compareTo
@API(status=INTERNAL) default int compareTo(AroundTryHook other)
-
-