Package net.jqwik.api.lifecycle
Interface ProvidePropertyInstanceHook
-
- 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.6.0") @FunctionalInterface public interface ProvidePropertyInstanceHook extends LifecycleHook
Implement this hook to override behaviour that provides the test instance for each property try. Per default the only accessible constructor of the container class is invoked, with all parameters being resolved through applicable ResolveParameterHook hooks.This hook can only be used in simple cases, since parameter resolution is currently unavailable to implementors.
Caveat: Only one hook per property method is possible.
-
-
Field Summary
Fields Modifier and Type Field Description static ProvidePropertyInstanceHook
DEFAULT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
provide(java.lang.Class<?> containerClass)
Create the test instance for running a property or example.-
Methods inherited from interface net.jqwik.api.lifecycle.LifecycleHook
appliesTo, propagateTo
-
-
-
-
Field Detail
-
DEFAULT
static final ProvidePropertyInstanceHook DEFAULT
-
-
Method Detail
-
provide
java.lang.Object provide(java.lang.Class<?> containerClass) throws java.lang.Throwable
Create the test instance for running a property or example. You may want to override the default call if provision does something else than plain instance creation from class.This method will be called exactly once per property. All tries share the same instance!
- Parameters:
containerClass
- The container class which runs the test- Returns:
- an object that must be assignable to
containerClass
- Throws:
java.lang.Throwable
-
-