Interface TestInstancePreConstructCallback
-
- 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.9") public interface TestInstancePreConstructCallback extends Extension
TestInstancePreConstructCallback
defines the API forExtensions
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.Constructor Requirements
Consult the documentation in
Extension
for details on constructor requirements.- Since:
- 5.9
- See Also:
TestInstancePreDestroyCallback
,TestInstanceFactory
,ParameterResolver
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
preConstructTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext context)
Callback invoked prior to test instances being constructed.
-
-
-
Method Detail
-
preConstructTestInstance
void preConstructTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext context) throws java.lang.Exception
Callback invoked prior to test instances being constructed.- Parameters:
factoryContext
- the context for the test instance about to be instantiated; nevernull
context
- the current extension context; nevernull
- Throws:
java.lang.Exception
-
-