@API(status=MAINTAINED,
     since="1.4.0")
public interface LifecycleContext
| Modifier and Type | Method and Description | 
|---|---|
<T extends java.lang.annotation.Annotation> | 
findAnnotation(java.lang.Class<T> annotationClass)
Retrieve an annotation if present at the current test element. 
 | 
<T extends java.lang.annotation.Annotation> | 
findAnnotationsInContainer(java.lang.Class<T> annotationClass)
Retrieve an annotation if present in the current element's containers. 
 | 
<T extends java.lang.annotation.Annotation> | 
findRepeatableAnnotations(java.lang.Class<T> annotationClass)
Retrieve a list of repeatable annotations if present at the current test element. 
 | 
java.lang.String | 
label()
The elements label under which it shows up in test reports and IDEs. 
 | 
<T> T | 
newInstance(java.lang.Class<T> clazz)
Create a new instance of a  
clazz in the context of the property in which it
 is running. | 
java.util.Optional<java.lang.Class<?>> | 
optionalContainerClass()
If the context refers to a class or a method the class or the method's class
 is returned, otherwise  
Optional.empty() | 
java.util.Optional<java.lang.reflect.AnnotatedElement> | 
optionalElement()
If the context refers to a class or a method the class or method
 is returned, otherwise  
Optional.empty() | 
Reporter | 
reporter()
Get hold of test reporter for publishing additional information on a test container or method. 
 | 
java.util.Optional<ResolveParameterHook.ParameterSupplier> | 
resolveParameter(java.lang.reflect.Executable executable,
                int index)
Resolve a parameter from a method in the context of the property in which it
 is running. 
 | 
void | 
wrapReporter(java.util.function.Function<Reporter,Reporter> wrapper)
Wrap reporter instance 
 | 
java.lang.String label()
java.util.Optional<java.lang.reflect.AnnotatedElement> optionalElement()
Optional.empty()java.util.Optional<java.lang.Class<?>> optionalContainerClass()
Optional.empty()Reporter reporter()
@API(status=EXPERIMENTAL,
     since="1.5.1")
void wrapReporter(java.util.function.Function<Reporter,Reporter> wrapper)
wrapper - Wrapping function that takes original reporter and returns a wrapped instance<T extends java.lang.annotation.Annotation> java.util.Optional<T> findAnnotation(java.lang.Class<T> annotationClass)
T - The annotation typeannotationClass - The annotation type<T extends java.lang.annotation.Annotation> java.util.List<T> findAnnotationsInContainer(java.lang.Class<T> annotationClass)
T - The annotation typeannotationClass - The annotation type@API(status=MAINTAINED,
     since="1.7.4")
<T extends java.lang.annotation.Annotation> java.util.List<T> findRepeatableAnnotations(java.lang.Class<T> annotationClass)
T - The annotation typeannotationClass - The annotation type<T> T newInstance(java.lang.Class<T> clazz)
clazz in the context of the property in which it
 is running. Use this method, for example, when trying to instantiate a class
 retrieved from an annotation's attribute.
 
 The behaviour of this method differs from Class.newInstance() if
 the class to instantiate is a non-static member of the container class or even
 a nested container class.
 
T - The type to instantiateclazz - The class to instantiateclazzjava.util.Optional<ResolveParameterHook.ParameterSupplier> resolveParameter(java.lang.reflect.Executable executable, int index)
executable - The executable of the test container the parameter of which should be resolvedindex - The parameter's position in a method - starting with 0.CannotResolveParameterException - if parameter cannot be resolved