TestInstantiationAwareExtension defines the API for Extensions that are aware of or influence the instantiation of test classes.
This interface is not intended to be implemented directly. Instead, extensions should implement one of the sub-interfaces listed below.
InvocationInterceptorParameterResolverTestInstancePreConstructCallbackTestInstancePostProcessorTestInstanceFactorySee getTestInstantiationExtensionContextScope(ExtensionContext) for
further details.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | TestInstantiationAwareExtension.
|
| Modifier and Type | Method and Description |
|---|---|
| public default TestInstantiationAwareExtension. | getTestInstantiationExtensionContextScope(ExtensionContext
the root extension context to allow inspection of
configuration parameters; never rootContext)nullDetermine whether this extension should receive a test-method scoped
|
| getTestInstantiationExtensionContextScope | back to summary |
|---|---|
| public default TestInstantiationAwareExtension. Determine whether this extension should receive a test-method scoped
If an extension returns
When a test-method scoped
Note The behavior which is enabled by returning
Implementation Note There are no guarantees about how often this method will be called.
Therefore, implementations should be idempotent and avoid side effects.
If computation of the return value is costly, implementations may wish to
cache the result in the
| |
ExtensionContextScope is used to define the scope of the
ExtensionContext supplied to an extension during the instantiation
of test classes or processing of test instances.
TestInstantiationAwareExtension#getTestInstantiationExtensionContextScope(ExtensionContext)
| Modifier and Type | Field and Description |
|---|---|
| public static final TestInstantiationAwareExtension. | DEFAULT
Deprecated
since 5.12. This behavior will be removed from future versions of
JUnit, and The extension should receive an TEST_METHOD will become the default.
ExtensionContext for the
the default scope.
|
| public static final String | DEFAULT_SCOPE_PROPERTY_NAME
Property name used to set the default extension context scope: Supported Values Supported values include names of enum constants defined in this class, ignoring case. |
| public static final TestInstantiationAwareExtension. | TEST_METHOD
The extension should receive an |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static TestInstantiationAwareExtension. | |
| public static TestInstantiationAwareExtension. |
| DEFAULT | back to summary |
|---|---|
| public static final TestInstantiationAwareExtension. Deprecated since 5.12. This behavior will be removed from future versions of
JUnit, and The extension should receive an The default scope is determined by the configuration parameter
| |
| DEFAULT_SCOPE_PROPERTY_NAME | back to summary |
|---|---|
| public static final String DEFAULT_SCOPE_PROPERTY_NAME Property name used to set the default extension context scope: Supported ValuesSupported values include names of enum constants defined in this class, ignoring case.
| |
| TEST_METHOD | back to summary |
|---|---|
| public static final TestInstantiationAwareExtension. The extension should receive an Note, however, that a test-class scoped context will always be
supplied if the
| |
| ExtensionContextScope | back to summary |
|---|---|
| private ExtensionContextScope() | |
| valueOf | back to summary |
|---|---|
| public static TestInstantiationAwareExtension. | |
| values | back to summary |
|---|---|
| public static TestInstantiationAwareExtension. | |