@API(value=Experimental) public interface MethodParameterResolver extends ExtensionPoint
MethodParameterResolver defines the API for Extensions that wish to dynamically resolve method parameters at runtime.
If a @Test,
@BeforeEach,
@AfterEach,
@BeforeAll, or
@AfterAll method accepts a parameter,
the parameter must be resolved at runtime by a MethodParameterResolver.
Implementations must provide a no-args constructor.
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
resolve(java.lang.reflect.Parameter parameter,
MethodInvocationContext methodInvocationContext,
ExtensionContext extensionContext)
|
boolean |
supports(java.lang.reflect.Parameter parameter,
MethodInvocationContext methodInvocationContext,
ExtensionContext extensionContext)
Determine if this resolver supports resolution of the given
Parameter
for the supplied MethodInvocationContext and ExtensionContext. |
boolean supports(java.lang.reflect.Parameter parameter,
MethodInvocationContext methodInvocationContext,
ExtensionContext extensionContext)
throws ParameterResolutionException
Parameter
for the supplied MethodInvocationContext and ExtensionContext.parameter - parameter to be resolvedmethodInvocationContext - method invocation context for the parameterextensionContext - extension context of the method about to be invokedtrue if this resolver can resolve the parameterParameterResolutionExceptionresolve(java.lang.reflect.Parameter, org.junit.gen5.api.extension.MethodInvocationContext, org.junit.gen5.api.extension.ExtensionContext)java.lang.Object resolve(java.lang.reflect.Parameter parameter,
MethodInvocationContext methodInvocationContext,
ExtensionContext extensionContext)
throws ParameterResolutionException
parameter - parameter to be resolvedmethodInvocationContext - method invocation context for the parameterextensionContext - extension context of the method about to be invokedParameterResolutionExceptionsupports(java.lang.reflect.Parameter, org.junit.gen5.api.extension.MethodInvocationContext, org.junit.gen5.api.extension.ExtensionContext)