Class ParameterResolutionUtils


  • @API(status=INTERNAL,
         since="5.9")
    public class ParameterResolutionUtils
    extends java.lang.Object
    ParameterResolutionUtils provides support for dynamic resolution of executable parameters via ParameterResolvers.
    Since:
    5.9
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.junit.platform.commons.logging.Logger logger  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String asLabel​(java.lang.reflect.Executable executable)  
      private static java.lang.Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext, java.lang.reflect.Executable executable, org.junit.jupiter.api.extension.ExtensionContext extensionContext, ExtensionRegistry extensionRegistry)  
      static java.lang.Object[] resolveParameters​(java.lang.reflect.Executable executable, java.util.Optional<java.lang.Object> target, java.util.Optional<java.lang.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 java.lang.Object[] resolveParameters​(java.lang.reflect.Method method, java.util.Optional<java.lang.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​(java.lang.reflect.Parameter parameter, java.lang.Object value, java.lang.reflect.Executable executable, org.junit.jupiter.api.extension.ParameterResolver resolver)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static final org.junit.platform.commons.logging.Logger logger
    • Constructor Detail

      • ParameterResolutionUtils

        public ParameterResolutionUtils()
    • Method Detail

      • resolveParameters

        public static java.lang.Object[] resolveParameters​(java.lang.reflect.Method method,
                                                           java.util.Optional<java.lang.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 parameters
        target - an Optional containing the target on which the executable will be invoked; never null but should be empty for static methods and constructors
        extensionContext - the current ExtensionContext
        extensionRegistry - the ExtensionRegistry to retrieve ParameterResolvers from
        Returns:
        the array of Objects to be used as parameters in the executable invocation; never null though potentially empty
      • resolveParameters

        public static java.lang.Object[] resolveParameters​(java.lang.reflect.Executable executable,
                                                           java.util.Optional<java.lang.Object> target,
                                                           java.util.Optional<java.lang.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 parameters
        target - an Optional containing the target on which the executable will be invoked; never null but should be empty for static methods and constructors
        outerInstance - the outer instance that will be supplied as the first argument to a constructor for an inner class; should be null for methods and constructors for top-level or static classes
        extensionContext - the current ExtensionContext
        extensionRegistry - the ExtensionRegistry to retrieve ParameterResolvers from
        Returns:
        the array of Objects to be used as parameters in the executable invocation; never null though potentially empty
      • resolveParameter

        private static java.lang.Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext,
                                                         java.lang.reflect.Executable executable,
                                                         org.junit.jupiter.api.extension.ExtensionContext extensionContext,
                                                         ExtensionRegistry extensionRegistry)
      • validateResolvedType

        private static void validateResolvedType​(java.lang.reflect.Parameter parameter,
                                                 java.lang.Object value,
                                                 java.lang.reflect.Executable executable,
                                                 org.junit.jupiter.api.extension.ParameterResolver resolver)
      • asLabel

        private static java.lang.String asLabel​(java.lang.reflect.Executable executable)