Interface ParameterResolver

All Superinterfaces:
Extension, TestInstantiationAwareExtension
All Known Implementing Classes:
TypeBasedParameterResolver

@API(status=STABLE, since="5.0") public interface ParameterResolver extends TestInstantiationAwareExtension
ParameterResolver defines the API for Extensions that wish to dynamically resolve arguments for parameters at runtime.

If a constructor for a test class or a @Test, @BeforeEach, @AfterEach, @BeforeAll, or @AfterAll method declares a parameter, an argument for the parameter must be resolved at runtime by a ParameterResolver.

By default, when the methods in this interface are called for a test class constructor, the supplied ExtensionContext represents the test class that's about to be instantiated. Extensions may override TestInstantiationAwareExtension.getTestInstantiationExtensionContextScope(org.junit.jupiter.api.extension.ExtensionContext) to return TEST_METHOD in order to change the scope of the ExtensionContext to the test method, unless the PER_CLASS lifecycle is used. Changing the scope makes test-specific data available to the implementation of this method and allows keeping state on the test level by using the provided Store instance.

Constructor Requirements

Consult the documentation in Extension for details on constructor requirements.

Since:
5.0
See Also: