Package net.jqwik.api.lifecycle
Interface MethodLifecycleContext
-
- All Superinterfaces:
LifecycleContext
- All Known Subinterfaces:
PropertyLifecycleContext
,TryLifecycleContext
@API(status=EXPERIMENTAL, since="1.7.4") public interface MethodLifecycleContext extends LifecycleContext
The context information for all method-based lifecyle contexts.- See Also:
PropertyLifecycleContext
,TryLifecycleContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<?>
containerClass()
The container class in which the current property method is running.java.lang.reflect.Method
targetMethod()
The method that defines the current property or example.java.lang.Object
testInstance()
The current instance of the property's container class.java.util.List<java.lang.Object>
testInstances()
The list of the current instance of the property's container class and all its outer objects if it is in a nested class.-
Methods inherited from interface net.jqwik.api.lifecycle.LifecycleContext
findAnnotation, findAnnotationsInContainer, findRepeatableAnnotations, label, newInstance, optionalContainerClass, optionalElement, reporter, resolveParameter, wrapReporter
-
-
-
-
Method Detail
-
targetMethod
@API(status=MAINTAINED, since="1.4.0") java.lang.reflect.Method targetMethod()
The method that defines the current property or example.- Returns:
- a Method instance
-
containerClass
@API(status=MAINTAINED, since="1.4.0") java.lang.Class<?> containerClass()
The container class in which the current property method is running.Most of the time that's also the defining class. It differs when running properties that are defined in a super class or an implemented interface.
- Returns:
- a Class instance
-
testInstance
@API(status=MAINTAINED, since="1.4.0") java.lang.Object testInstance()
The current instance of the property's container class. There is exactly one instance per property method.- Returns:
- an instance of the container class in which the current property method is running
-
testInstances
@API(status=MAINTAINED, since="1.5.4") java.util.List<java.lang.Object> testInstances()
The list of the current instance of the property's container class and all its outer objects if it is in a nested class. The result of testInstance() is the last in the list.- Returns:
- List of instances starting from outer-most to inner-most class
-
-