Package org.apache.flink.test.util
Class TestBaseUtils
java.lang.Object
org.apache.flink.test.util.TestBaseUtils
Utility class containing various methods for testing purposes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTestBaseUtils.TupleComparator<T extends org.apache.flink.api.java.tuple.Tuple>Comparator for comparable Tuples. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Filestatic 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)
-
Constructor Details
-
TestBaseUtils
public TestBaseUtils()
-
-
Method Details
-
getResultReader
- Throws:
IOException
-
readAllResultLines
- 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
-
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
-
compareResultAsTuples
-
compareResultAsText
-
compareOrderedResultAsText
-
containsResultAsText
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.
-