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, declaratively via a
field of the test class, or programmatically
via a static field of the test class.
Consult the documentation in Extension for details on
constructor requirements.
ExtensionContext ScopeAs of JUnit Jupiter 5.12, this API participates in the
TestInstantiationAwareExtension contract. Implementations of this API
may therefore choose to override
getTestInstantiationExtensionContextScope(ExtensionContext) to require a
test-method scoped ExtensionContext. See
postProcessTestInstance(Object, ExtensionContext) for further details.
postProcessTestInstance(Object, ExtensionContext), TestInstancePreDestroyCallback, TestInstanceFactory, ParameterResolver
| Modifier and Type | Method and Description |
|---|---|
| public void | postProcessTestInstance(Object
the instance to post-process; never testInstance, ExtensionContext nullthe current extension context; never context)nullCallback for post-processing the supplied test instance. |
| postProcessTestInstance | back to summary |
|---|---|
| public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception Callback for post-processing the supplied test instance. By default, the supplied Note the
| |