java.lang.Object
com.pervasive.datarush.commons.test.AssertionsUtil
A collection of methods providing assertions useful in tests. These
supplement the standard set of test assertions provided by a testing
framework such as JUnit.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA filter used to determine whether line mismatches are significant. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertArrayEquals(Object[] expecteds, Object[] actuals) static voidassertArrayEquals(String message, Object[] expecteds, Object[] actuals) static voidassertDirectoriesEqual(File expectedPath, File actualPath) Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String).static voidassertDirectoriesEqual(File expectedPath, File actualPath, AssertionsUtil.MismatchFilter mismatchFilter) Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String, MismatchFilter).static final voidassertDirectoriesEqual(String expectedPath, String actualPath) Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String).static voidassertEquals(Object expected, Object actual) static voidassertEquals(String expected, String actual) static voidassertLinesEqual(String expectedOutput, String actualOutput) Compares two files, line-by-line.static voidassertLinesEqual(String expectedOutput, String actualOutput, AssertionsUtil.MismatchFilter filter) Compares two files, line-by-line.static voidassertTrue(boolean condition) static voidassertTrue(String message, boolean condition)
-
Method Details
-
assertLinesEqual
Compares two files, line-by-line. The newline style ( windows vs. unix ) is not considered by the comparison.- Parameters:
expectedOutput- The expected output fileactualOutput- The actual output file
-
assertLinesEqual
public static void assertLinesEqual(String expectedOutput, String actualOutput, AssertionsUtil.MismatchFilter filter) Compares two files, line-by-line. The newline style ( windows vs. unix ) is not considered by the comparison.- Parameters:
expectedOutput- The expected output fileactualOutput- The actual output filefilter- Mismatching lines are handed to this filter to determine whether the mismatch is to be considered significant
-
assertDirectoriesEqual
Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String).- Parameters:
expectedPath- the directory containing the expected filesactualPath- the directory containing the actual files
-
assertDirectoriesEqual
Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String).- Parameters:
expectedPath- the directory containing the expected filesactualPath- the directory containing the actual files
-
assertDirectoriesEqual
public static void assertDirectoriesEqual(File expectedPath, File actualPath, AssertionsUtil.MismatchFilter mismatchFilter) Compares all files in the two directories, line-by-line, usingassertLinesEqual(String, String, MismatchFilter).- Parameters:
expectedPath- the directory containing the expected filesactualPath- the directory containing the actual filesmismatchFilter- Mismatching lines are handed to this filter to determine whether the mismatch is to be considered significant
-
assertEquals
-
assertEquals
-
assertArrayEquals
-
assertArrayEquals
public static void assertArrayEquals(String message, Object[] expecteds, Object[] actuals) throws AssertionError - Throws:
AssertionError
-
assertTrue
public static void assertTrue(boolean condition) -
assertTrue
-