Class ParameterizedTestSupport


  • public final class ParameterizedTestSupport
    extends java.lang.Object
    Utility class for managing JUnit Jupiter Params dependency availability at runtime. This enables graceful degradation when parametrized test support is not available. Provides safe class loading and caching for all JUnit params annotations and classes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isAvailable()
      Checks if JUnit Jupiter Params dependency is available on the classpath.
      static boolean isJunitParamsAnnotation​(java.lang.annotation.Annotation annotation)
      Checks if an annotation is a JUnit params annotation.
      static boolean isParameterizedTest​(java.lang.reflect.Method method)
      Checks if a method has the ParameterizedTest annotation.
      static java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> loadAnnotationClass​(java.lang.String simpleName)
      Safely loads a JUnit params annotation class by simple name.
      static java.util.Optional<java.lang.Class<?>> loadClass​(java.lang.String simpleName)
      Safely loads a JUnit params class by simple name.
      static java.util.Optional<java.lang.Class<?>> loadClassByName​(java.lang.String className)
      Safely loads a class by its full qualified name.
      • Methods inherited from class java.lang.Object

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

      • isAvailable

        public static boolean isAvailable()
        Checks if JUnit Jupiter Params dependency is available on the classpath.
        Returns:
        true if ParameterizedTest annotation is available, false otherwise
      • loadClass

        public static java.util.Optional<java.lang.Class<?>> loadClass​(java.lang.String simpleName)
        Safely loads a JUnit params class by simple name.
        Parameters:
        simpleName - the simple name of the class
        Returns:
        Optional containing the class if available, empty otherwise
      • loadAnnotationClass

        public static java.util.Optional<java.lang.Class<? extends java.lang.annotation.Annotation>> loadAnnotationClass​(java.lang.String simpleName)
        Safely loads a JUnit params annotation class by simple name.
        Parameters:
        simpleName - the simple name of the annotation class
        Returns:
        Optional containing the annotation class if available, empty otherwise
      • loadClassByName

        public static java.util.Optional<java.lang.Class<?>> loadClassByName​(java.lang.String className)
        Safely loads a class by its full qualified name.
        Parameters:
        className - the fully qualified class name
        Returns:
        Optional containing the class if available, empty otherwise
      • isJunitParamsAnnotation

        public static boolean isJunitParamsAnnotation​(java.lang.annotation.Annotation annotation)
        Checks if an annotation is a JUnit params annotation.
        Parameters:
        annotation - the annotation to check
        Returns:
        true if it's a known JUnit params annotation, false otherwise
      • isParameterizedTest

        public static boolean isParameterizedTest​(java.lang.reflect.Method method)
        Checks if a method has the ParameterizedTest annotation.
        Parameters:
        method - the method to check
        Returns:
        true if the method has @ParameterizedTest annotation, false otherwise