org.apache.flink.testutils.CustomEqualityMatcher Java Examples

The following examples show how to use org.apache.flink.testutils.CustomEqualityMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArrowSourceFunctionTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
private void checkElementsEquals(List<T> actual, List<T> expected) {
	Assert.assertEquals(actual.size(), expected.size());
	actual.sort(comparator);
	expected.sort(comparator);
	for (int i = 0; i < expected.size(); i++) {
		assertThat(actual.get(i), CustomEqualityMatcher.deeplyEquals(expected.get(i)).withChecker(checker));
	}
}
 
Example #2
Source File: ArrowReaderWriterTestBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testBasicFunctionality() {
	try {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		Tuple2<ArrowWriter<T>, ArrowStreamWriter> tuple2 = createArrowWriter(baos);
		ArrowWriter<T> arrowWriter = tuple2.f0;
		ArrowStreamWriter arrowStreamWriter = tuple2.f1;

		T[] testData = getTestData();
		for (T value : testData) {
			arrowWriter.write(value);
		}
		arrowWriter.finish();
		arrowStreamWriter.writeBatch();

		ArrowReader<T> arrowReader = createArrowReader(new ByteArrayInputStream(baos.toByteArray()));
		for (int i = 0; i < testData.length; i++) {
			T deserialized = arrowReader.read(i);
			assertThat("Deserialized value is wrong.",
				deserialized, CustomEqualityMatcher.deeplyEquals(testData[i]).withChecker(checker));
		}
	}
	catch (Exception e) {
		System.err.println(e.getMessage());
		e.printStackTrace();
		fail("Exception in test: " + e.getMessage());
	}
}
 
Example #3
Source File: SerializerTestBase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private void deepEquals(String message, T should, T is) {
	assertThat(message, is, CustomEqualityMatcher.deeplyEquals(should).withChecker(checker));
}
 
Example #4
Source File: SerializerTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
private void deepEquals(String message, T should, T is) {
	assertThat(message, is, CustomEqualityMatcher.deeplyEquals(should).withChecker(checker));
}
 
Example #5
Source File: SerializerTestBase.java    From flink with Apache License 2.0 4 votes vote down vote up
private void deepEquals(String message, T should, T is) {
	assertThat(message, is, CustomEqualityMatcher.deeplyEquals(should).withChecker(checker));
}