public class TestDataTools extends Object
| Constructor and Description |
|---|
TestDataTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getClassName(Class<?> clazz)
Translates a class name.
|
static <E extends Enum<?>> |
getEnumName(E item)
Translates an enumeration constant's name.
|
static String |
getTimestamp(int length)
Returns a timestamp value.
|
static String |
getUUID()
Returns a UUID as string.
|
public static <E extends Enum<?>> String getEnumName(E item)
This method tries to find a Name annotation on the given constant.
If the annotation present then the result will be it's value.
Otherwise the constant's original name will be used.
E - type of the enum constantitem - the enum constantpublic static String getClassName(Class<?> clazz)
This method tries to find a Name annotation on the given class.
If the annotation present then the result will be it's value.
Otherwise the simple name of the class will be used.
clazz - the java classpublic static String getTimestamp(int length)
Returns a timestamp value. The timestamp does not change during the whole test run. It is generated at the beginning. With timestamp we can create unique (time-related) identifiers in a database.
This method returns the first length characters of the timestamp. For example, the first 8 characters
contains the year, the month and the day, the first 12 characters contains the hours and the minutes too.
length - maximum length of the returned timestamppublic static String getUUID()
Created by Kornél Simon, 2022