Class TestCaseIdUtils


  • public class TestCaseIdUtils
    extends java.lang.Object
    A static class which contains methods to generate Test Case IDs and code references.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getCodeRef​(java.lang.reflect.Executable executable)
      Generates a text code reference by consuming a Executable
      static <T> java.lang.String getParametersForTestCaseId​(java.lang.reflect.Executable executable, java.util.List<T> parameters)
      Returns a string of parameters values, separated by comma and embraced by '[]'.
      static <T> TestCaseIdEntry getTestCaseId​(TestCaseId annotation, java.lang.reflect.Executable executable, java.lang.String codRef, java.util.List<T> parameters)
      Generates a TestCaseIdEntry
      static <T> TestCaseIdEntry getTestCaseId​(TestCaseId annotation, java.lang.reflect.Executable executable, java.lang.String codRef, java.util.List<T> parameters, java.lang.Object testInstance)
      Generates a TestCaseIdEntry
      static <T> TestCaseIdEntry getTestCaseId​(TestCaseId annotation, java.lang.reflect.Executable executable, java.util.List<T> parameters)
      Generates a TestCaseIdEntry
      static <T> TestCaseIdEntry getTestCaseId​(java.lang.reflect.Executable executable, java.util.List<T> parameters)
      Generates Test Case ID based on an executable reference and a list of parameters
      static <T> TestCaseIdEntry getTestCaseId​(java.lang.String codeRef, java.util.List<T> parameters)
      Generates Test Case ID based on a code reference and a list of parameters
      static <T> TestCaseIdEntry getTestCaseId​(java.util.List<T> parameters)
      Generates Test Case ID based on a list of parameters
      • Methods inherited from class java.lang.Object

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

      • getCodeRef

        @Nonnull
        public static java.lang.String getCodeRef​(@Nonnull
                                                  java.lang.reflect.Executable executable)
        Generates a text code reference by consuming a Executable
        Parameters:
        executable - an executable or constructor, the value should not be null
        Returns:
        a text code reference
      • getParametersForTestCaseId

        @Nullable
        public static <T> java.lang.String getParametersForTestCaseId​(java.lang.reflect.Executable executable,
                                                                      java.util.List<T> parameters)
        Returns a string of parameters values, separated by comma and embraced by '[]'.
        Type Parameters:
        T - a type of parameters
        Parameters:
        executable - a constructor or method
        parameters - a list of parameter values
        Returns:
        a string representation of parameters
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        TestCaseId annotation,
                                                        @Nullable
                                                        java.lang.reflect.Executable executable,
                                                        @Nullable
                                                        java.util.List<T> parameters)
        Generates a TestCaseIdEntry
        Type Parameters:
        T - a type of parameters
        Parameters:
        annotation - a TestCaseId annotation instance
        executable - a constructor or method for TestCaseIdKey scan
        parameters - a list of parameter values
        Returns:
        Test Case ID or null if not possible to generate (all parameters are nulls, empty, etc.)
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        TestCaseId annotation,
                                                        @Nullable
                                                        java.lang.reflect.Executable executable,
                                                        @Nullable
                                                        java.lang.String codRef,
                                                        @Nullable
                                                        java.util.List<T> parameters)
        Generates a TestCaseIdEntry
        Type Parameters:
        T - a type of parameters
        Parameters:
        annotation - a TestCaseId annotation instance
        executable - a constructor or method for TestCaseIdKey scan
        codRef - a code reference to use to generate the ID
        parameters - a list of parameter values
        Returns:
        Test Case ID or null if not possible to generate (all parameters are nulls, empty, etc.)
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        TestCaseId annotation,
                                                        @Nullable
                                                        java.lang.reflect.Executable executable,
                                                        @Nullable
                                                        java.lang.String codRef,
                                                        @Nullable
                                                        java.util.List<T> parameters,
                                                        @Nullable
                                                        java.lang.Object testInstance)
        Generates a TestCaseIdEntry
        Type Parameters:
        T - a type of parameters
        Parameters:
        annotation - a TestCaseId annotation instance
        executable - a constructor or method for TestCaseIdKey scan
        codRef - a code reference to use to generate the ID
        parameters - a list of parameter values
        testInstance - an instance of the current test, used in template processing
        Returns:
        Test Case ID or null if not possible to generate (all parameters are nulls, empty, etc.)
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        java.lang.reflect.Executable executable,
                                                        @Nullable
                                                        java.util.List<T> parameters)
        Generates Test Case ID based on an executable reference and a list of parameters
        Type Parameters:
        T - parameters type
        Parameters:
        executable - a Executable object
        parameters - a list of parameters
        Returns:
        a Test Case ID or null
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        java.lang.String codeRef,
                                                        @Nullable
                                                        java.util.List<T> parameters)
        Generates Test Case ID based on a code reference and a list of parameters
        Type Parameters:
        T - parameters type
        Parameters:
        codeRef - a code reference
        parameters - a list of parameters
        Returns:
        a Test Case ID or null
      • getTestCaseId

        @Nullable
        public static <T> TestCaseIdEntry getTestCaseId​(@Nullable
                                                        java.util.List<T> parameters)
        Generates Test Case ID based on a list of parameters
        Type Parameters:
        T - parameters type
        Parameters:
        parameters - a list of parameters
        Returns:
        a Test Case ID or null