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 class
TestBaseUtils.TupleComparator<T extends 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 File
asFile(String path)
static void
checkLinesAgainstRegexp(String resultPath, String regexp)
static void
compareKeyValuePairsWithDelta(String expectedLines, String resultPath, String delimiter, double maxDelta)
static <T> void
compareOrderedResultAsText(List<T> result, String expected)
static <T> void
compareResultAsText(List<T> result, String expected)
static <T> void
compareResultAsTuples(List<T> result, String expected)
static <X> void
compareResultCollections(List<X> expected, List<X> actual, Comparator<X> comparator)
static void
compareResultsByLinesInMemory(String expectedResultStr, String resultPath)
static void
compareResultsByLinesInMemory(String expectedResultStr, String resultPath, String[] excludePrefixes)
static void
compareResultsByLinesInMemoryWithStrictOrder(String expectedResultStr, String resultPath)
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.static BufferedReader[]
getResultReader(String resultPath)
static void
readAllResultLines(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.
-
-