Package es.bsc.dataclay.test
Class TestUtils
- java.lang.Object
-
- es.bsc.dataclay.test.TestUtils
-
public final class TestUtils extends Object
- Author:
- dgasull
-
-
Field Summary
Fields Modifier and Type Field Description static String
GETTER_PREFFIX
static String
SETTER_PREFFIX
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
cleanDirectory(String dirName)
static Object
createInstance(Class<?> instanceClass)
static void
createOrCleanDirectory(String dirName)
static void
deleteDirectory(String dirName)
static void
generateFieldValuesRecursively(Object stubInstance, Object anotherStubInstance, boolean useSelfLoop)
static Class<?>
getClass(String clName, ClassLoader cl)
static Class<?>
getClassNonPrimitive(String clName, ClassLoader cl)
static Object
getRandomValue(boolean first)
static Object
getRandomValue(Class<?> classParam, boolean first)
-
-
-
Field Detail
-
GETTER_PREFFIX
public static final String GETTER_PREFFIX
- See Also:
- Constant Field Values
-
SETTER_PREFFIX
public static final String SETTER_PREFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getClass
public static Class<?> getClass(String clName, ClassLoader cl)
- Parameters:
clName
- Name of the class to loadcl
- 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 classcl
- 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 generatefirst
- 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
-
createInstance
public static Object createInstance(Class<?> instanceClass) throws Exception
- Throws:
Exception
-
createOrCleanDirectory
public static void createOrCleanDirectory(String dirName)
-
cleanDirectory
public static void cleanDirectory(String dirName)
-
deleteDirectory
public static void deleteDirectory(String dirName)
-
-