Class TestBaseUtils

java.lang.Object
org.apache.flink.test.util.TestBaseUtils

public class TestBaseUtils extends Object
Utility class containing various methods for testing purposes.
  • Constructor Details

    • TestBaseUtils

      public TestBaseUtils()
  • Method Details

    • getResultReader

      public static BufferedReader[] getResultReader(String resultPath) throws IOException
      Throws:
      IOException
    • readAllResultLines

      public static void readAllResultLines(List<String> target, String resultPath) throws IOException
      Throws:
      IOException
    • compareResultsByLinesInMemory

      public static void compareResultsByLinesInMemory(String expectedResultStr, String resultPath) throws Exception
      Throws:
      Exception
    • compareResultsByLinesInMemory

      public static void compareResultsByLinesInMemory(String expectedResultStr, String resultPath, String[] excludePrefixes) throws Exception
      Throws:
      Exception
    • compareResultsByLinesInMemoryWithStrictOrder

      public static void compareResultsByLinesInMemoryWithStrictOrder(String expectedResultStr, String resultPath) throws Exception
      Throws:
      Exception
    • checkLinesAgainstRegexp

      public static void checkLinesAgainstRegexp(String resultPath, String regexp)
    • compareKeyValuePairsWithDelta

      public static void compareKeyValuePairsWithDelta(String expectedLines, String resultPath, String delimiter, double maxDelta) throws Exception
      Throws:
      Exception
    • compareResultCollections

      public static <X> void compareResultCollections(List<X> expected, List<X> actual, Comparator<X> comparator)
    • asFile

      public static File asFile(String path)
    • compareResultAsTuples

      public static <T> void compareResultAsTuples(List<T> result, String expected)
    • compareResultAsText

      public static <T> void compareResultAsText(List<T> result, String expected)
    • compareOrderedResultAsText

      public static <T> void compareOrderedResultAsText(List<T> result, String expected)
    • containsResultAsText

      public static <T> void containsResultAsText(List<T> result, String expected)
      The expected string contains all expected results separate with line break, check whether all elements in result are contained in the expected string.
      Type Parameters:
      T - The result type.
      Parameters:
      result - The test result.
      expected - The expected string value combination.