Package org.junit.jupiter.api.extension
Interface TestInstancePostProcessor
-
- All Superinterfaces:
Extension
@API(status=STABLE, since="5.0") public interface TestInstancePostProcessor extends Extension
TestInstancePostProcessordefines the API forExtensionsthat wish to post-process test instances.Common use cases include injecting dependencies into the test instance, invoking custom initialization methods on the test instance, etc.
Implementations must provide a no-args constructor.
Extensions that implement
TestInstancePostProcessormust be registered at the class level.- Since:
- 5.0
- See Also:
postProcessTestInstance(Object, ExtensionContext)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidpostProcessTestInstance(java.lang.Object testInstance, ExtensionContext context)Callback for post-processing the supplied test instance.
-
-
-
Method Detail
-
postProcessTestInstance
void postProcessTestInstance(java.lang.Object testInstance, ExtensionContext context) throws java.lang.ExceptionCallback for post-processing the supplied test instance.Note: the
ExtensionContextsupplied to aTestInstancePostProcessorwill always return an emptyOptionalvalue fromgetTestInstance(). ATestInstancePostProcessorshould therefore only attempt to process the suppliedtestInstance.- Parameters:
testInstance- the instance to post-process; nevernullcontext- the current extension context; nevernull- Throws:
java.lang.Exception
-
-