Package org.apache.flink.test.util
Class TestBaseUtils
- java.lang.Object
-
- org.apache.flink.test.util.TestBaseUtils
-
public class TestBaseUtils extends Object
Utility class containing various methods for testing purposes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestBaseUtils.TupleComparator<T extends org.apache.flink.api.java.tuple.Tuple>Comparator for comparable Tuples.
-
Constructor Summary
Constructors Constructor Description TestBaseUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FileasFile(String path)static voidcheckLinesAgainstRegexp(String resultPath, String regexp)static voidcompareKeyValuePairsWithDelta(String expectedLines, String resultPath, String delimiter, double maxDelta)static <T> voidcompareOrderedResultAsText(List<T> result, String expected)static <T> voidcompareResultAsText(List<T> result, String expected)static <T> voidcompareResultAsTuples(List<T> result, String expected)static <X> voidcompareResultCollections(List<X> expected, List<X> actual, Comparator<X> comparator)static voidcompareResultsByLinesInMemory(String expectedResultStr, String resultPath)static voidcompareResultsByLinesInMemory(String expectedResultStr, String resultPath, String[] excludePrefixes)static voidcompareResultsByLinesInMemoryWithStrictOrder(String expectedResultStr, String resultPath)static <T> voidcontainsResultAsText(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.static BufferedReader[]getResultReader(String resultPath)static voidreadAllResultLines(List<String> target, String resultPath)
-
-
-
Method Detail
-
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)
-
compareResultAsTuples
public static <T> void compareResultAsTuples(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.
-
-