@FunctionalInterface
@API(status=EXPERIMENTAL,
since="5.9")
public interface TestInstancePreConstructCallback
extends Extension
TestInstancePreConstructCallback defines the API for Extensions that wish to be invoked prior to creation of test instances.
This extension is a symmetric counterpart to TestInstancePreDestroyCallback.
The use cases for this extension may include preparing context-sensitive arguments
that are injected into the instance's constructor.
Extensions that implement TestInstancePreConstructCallback must be
registered at the class level if the test class is configured with
@TestInstance(Lifecycle.PER_CLASS) semantics. If the test
class is configured with
@TestInstance(Lifecycle.PER_METHOD) semantics,
TestInstancePreConstructCallback extensions may be registered at the
class level or at the method level. In the latter case, the extension will
only be applied to the test method for which it is registered.
Consult the documentation in Extension for details on constructor
requirements.
TestInstancePreDestroyCallback,
TestInstanceFactory,
ParameterResolver| Modifier and Type | Method and Description |
|---|---|
void |
preConstructTestInstance(TestInstanceFactoryContext factoryContext,
ExtensionContext context)
Callback invoked prior to test instances being constructed.
|
void preConstructTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext context) throws java.lang.Exception
factoryContext - the context for the test instance about to be instantiated;
never nullcontext - the current extension context; never nulljava.lang.Exception