@FunctionalInterface
@API(status=STABLE,
since="5.0")
public interface TestInstancePostProcessor
extends Extension
TestInstancePostProcessor defines the API for Extensions that 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.
Extensions that implement TestInstancePostProcessor must be
registered at the class level.
Consult the documentation in Extension for details on
constructor requirements.
postProcessTestInstance(Object, ExtensionContext),
TestInstanceFactory,
ParameterResolver| Modifier and Type | Method and Description |
|---|---|
void |
postProcessTestInstance(java.lang.Object testInstance,
ExtensionContext context)
Callback for post-processing the supplied test instance.
|
void postProcessTestInstance(java.lang.Object testInstance,
ExtensionContext context)
throws java.lang.Exception
Note: the ExtensionContext supplied to a
TestInstancePostProcessor will always return an empty
Optional value from getTestInstance(). A TestInstancePostProcessor should therefore
only attempt to process the supplied testInstance.
testInstance - the instance to post-process; never nullcontext - the current extension context; never nulljava.lang.Exception