Class TestUtils


  • public final class TestUtils
    extends Object
    Author:
    dgasull
    • Method Detail

      • getClass

        public static Class<?> getClass​(String clName,
                                        ClassLoader cl)
        Parameters:
        clName - Name of the class to load
        cl - Classloader containing the class
        Returns:
        The class with name provided in the classloader provided
      • getClassNonPrimitive

        public static Class<?> getClassNonPrimitive​(String clName,
                                                    ClassLoader cl)
        Parameters:
        clName - Name of the class
        cl - ClassLoader containing the class
        Returns:
        The class with name provided in the classloader provided. If the class name indicates a primitive type, then the object class representing the primitive type is returned (Integer, Double,...)
      • getRandomValue

        public static Object getRandomValue​(Class<?> classParam,
                                            boolean first)
        Parameters:
        classParam - Class of the type to generate
        first - Must be true. Used in recursive calls.
        Returns:
        An object representing a random value of the class provided (including arrays of random values) or null if the class is not primitive.
      • getRandomValue

        public static Object getRandomValue​(boolean first)
      • generateFieldValuesRecursively

        public static void generateFieldValuesRecursively​(Object stubInstance,
                                                          Object anotherStubInstance,
                                                          boolean useSelfLoop)
                                                   throws Exception
        Parameters:
        stubInstance -
        anotherStubInstance -
        Throws:
        Exception
      • createOrCleanDirectory

        public static void createOrCleanDirectory​(String dirName)
      • cleanDirectory

        public static void cleanDirectory​(String dirName)
      • deleteDirectory

        public static void deleteDirectory​(String dirName)