Package de.galan.commons.test
Class Tests
- java.lang.Object
-
- de.galan.commons.test.Tests
-
public class Tests extends Object
Common helper methods that are helpful for Test-Classes via static imports.
-
-
Constructor Summary
Constructors Constructor Description Tests()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertBetween(Double expectedLower, Double expectedUpper, Double actual)static voidassertBetween(Long expectedLow, Long expectedHigh, Long actual)static voidassertBetween(Date expectedFrom, Date expectedTo, Date actual)static voidassertBetween(Date expectedFrom, Date expectedTo, Date actual, boolean truncateMillis)static voidassertDateNear(long msThreshold, Date actual)static voidassertDateNear(long msThreshold, Date actual, boolean truncateMillis)static voidassertDateNear(String timeThreshold, Instant actual)static voidassertDateNear(String timeThreshold, Date actual)static voidassertDateNear(String timeThreshold, Date actual, boolean truncateMillis)static voidassertFileEqualsToString(String filename, Class<?> clz, String actual)static voidassertListEquals(List<?> expected, List<?> actual)static FilegetTestDirectory()static FilegetTestDirectory(boolean cleanup)static StringgetWorkingDirectory()static StringreadFile(InputStream is)static StringreadFile(InputStream is, Charset encoding)static StringreadFile(Class<?> clazz, String filename)static StringreadFile(Class<?> clazz, String filename, Charset encoding)static StringreadFile(String filename)static StringreadFile(String filename, Charset encoding)static byte[]readFileBinary(Class<?> clazz, String filename)
-
-
-
Method Detail
-
getWorkingDirectory
public static String getWorkingDirectory()
-
getTestDirectory
public static File getTestDirectory(boolean cleanup)
-
getTestDirectory
public static File getTestDirectory()
-
readFileBinary
public static byte[] readFileBinary(Class<?> clazz, String filename) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(String filename) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(String filename, Charset encoding) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(Class<?> clazz, String filename) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(Class<?> clazz, String filename, Charset encoding) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(InputStream is) throws IOException
- Throws:
IOException
-
readFile
public static String readFile(InputStream is, Charset encoding) throws IOException
- Throws:
IOException
-
assertFileEqualsToString
public static void assertFileEqualsToString(String filename, Class<?> clz, String actual) throws IOException
- Throws:
IOException
-
assertBetween
public static void assertBetween(Date expectedFrom, Date expectedTo, Date actual, boolean truncateMillis)
-
assertBetween
public static void assertBetween(Double expectedLower, Double expectedUpper, Double actual)
-
assertDateNear
public static void assertDateNear(long msThreshold, Date actual)
-
assertDateNear
public static void assertDateNear(long msThreshold, Date actual, boolean truncateMillis)
-
-