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 Details

    • Tests

      public Tests()
  • Method Details

    • 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(Long expectedLow, Long expectedHigh, Long actual)
    • assertListEquals

      public static void assertListEquals(List<?> expected, List<?> actual)
    • assertBetween

      public static void assertBetween(Date expectedFrom, Date expectedTo, Date actual)
    • 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)
    • assertDateNear

      public static void assertDateNear(String timeThreshold, Date actual)
    • assertDateNear

      public static void assertDateNear(String timeThreshold, Instant actual)
    • assertDateNear

      public static void assertDateNear(String timeThreshold, Date actual, boolean truncateMillis)