Class ParameterResolutionUtils
java.lang.Object
org.junit.jupiter.engine.execution.ParameterResolutionUtils
ParameterResolutionUtils
provides support for dynamic resolution
of executable parameters via ParameterResolvers
.- Since:
- 5.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.junit.platform.commons.logging.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
asLabel
(Executable executable) private static Object
resolveParameter
(org.junit.jupiter.api.extension.ParameterContext parameterContext, Executable executable, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) static Object[]
resolveParameters
(Executable executable, Optional<Object> target, Optional<Object> outerInstance, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) Resolve the array of parameters for the supplied executable, target, and outer instance.static Object[]
resolveParameters
(Method method, Optional<Object> target, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) Resolve the array of parameters for the supplied method and target.private static void
validateResolvedType
(Parameter parameter, Object value, Executable executable, org.junit.jupiter.api.extension.ParameterResolver resolver)
-
Field Details
-
logger
private static final org.junit.platform.commons.logging.Logger logger
-
-
Constructor Details
-
ParameterResolutionUtils
public ParameterResolutionUtils()
-
-
Method Details
-
resolveParameters
public static Object[] resolveParameters(Method method, Optional<Object> target, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) Resolve the array of parameters for the supplied method and target.- Parameters:
method
- the method for which to resolve parameterstarget
- anOptional
containing the target on which the executable will be invoked; nevernull
but should be empty for static methods and constructorsextensionContext
- the currentExtensionContext
extensionRegistry
- theExtensionRegistry
to retrieveParameterResolvers
from- Returns:
- the array of Objects to be used as parameters in the executable
invocation; never
null
though potentially empty
-
resolveParameters
public static Object[] resolveParameters(Executable executable, Optional<Object> target, Optional<Object> outerInstance, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) Resolve the array of parameters for the supplied executable, target, and outer instance.- Parameters:
executable
- the executable for which to resolve parameterstarget
- anOptional
containing the target on which the executable will be invoked; nevernull
but should be empty for static methods and constructorsouterInstance
- the outer instance that will be supplied as the first argument to a constructor for an inner class; should benull
for methods and constructors for top-level or static classesextensionContext
- the currentExtensionContext
extensionRegistry
- theExtensionRegistry
to retrieveParameterResolvers
from- Returns:
- the array of Objects to be used as parameters in the executable
invocation; never
null
though potentially empty
-
resolveParameter
private static Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, Executable executable, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) -
validateResolvedType
private static void validateResolvedType(Parameter parameter, Object value, Executable executable, org.junit.jupiter.api.extension.ParameterResolver resolver) -
asLabel
-