Package org.junit.jupiter.api.extension
Interface TestInstancePreDestroyCallback
-
- All Superinterfaces:
Extension
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @API(status=EXPERIMENTAL, since="5.6") public interface TestInstancePreDestroyCallback extends ExtensionTestInstancePreDestroyCallbackdefines the API forExtensionsthat wish to process test instances after they have been used in tests and before they are destroyed.Common use cases include cleaning dependencies that have been injected into the test instance, invoking custom de-initialization methods on the test instance, etc.
Extensions that implement
TestInstancePreDestroyCallbackmust be registered at the class level.Constructor Requirements
Consult the documentation in
Extensionfor details on constructor requirements.- Since:
- 5.6
- See Also:
preDestroyTestInstance(ExtensionContext),TestInstanceFactory,ParameterResolver
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidpreDestroyTestInstance(ExtensionContext context)Callback for processing a test instance before it is destroyed.
-
-
-
Method Detail
-
preDestroyTestInstance
void preDestroyTestInstance(ExtensionContext context) throws java.lang.Exception
Callback for processing a test instance before it is destroyed.- Parameters:
context- the current extension context; nevernull- Throws:
java.lang.Exception- See Also:
ExtensionContext.getTestInstance(),ExtensionContext.getRequiredTestInstance()
-
-