Java Code Examples for org.apache.flink.api.common.typeutils.TypeInformationTestBase

The following examples show how to use org.apache.flink.api.common.typeutils.TypeInformationTestBase. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: TypeInfoTestCoverageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTypeInfoTestCoverage() {
	Reflections reflections = new Reflections("org.apache.flink");

	Set<Class<? extends TypeInformation>> typeInfos = reflections.getSubTypesOf(TypeInformation.class);

	Set<String> typeInfoTestNames = reflections.getSubTypesOf(TypeInformationTestBase.class)
			.stream().map(Class::getName).collect(Collectors.toSet());

	// check if a test exists for each type information
	for (Class<? extends TypeInformation> typeInfo : typeInfos) {
		// we skip abstract classes and inner classes to skip type information defined in test classes
		if (Modifier.isAbstract(typeInfo.getModifiers()) ||
				Modifier.isPrivate(typeInfo.getModifiers()) ||
				typeInfo.getName().contains("Test$") ||
				typeInfo.getName().contains("TestBase$") ||
				typeInfo.getName().contains("ITCase$") ||
				typeInfo.getName().contains("$$anon") ||
				typeInfo.getName().contains("queryablestate")) {
			continue;
		}

		final String testToFind = typeInfo.getName() + "Test";
		if (!typeInfoTestNames.contains(testToFind)) {
			fail("Could not find test '" + testToFind + "' that covers '" + typeInfo.getName() + "'.");
		}
	}
}
 
Example 2
Source Project: flink   Source File: TypeInfoTestCoverageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTypeInfoTestCoverage() {
	Reflections reflections = new Reflections("org.apache.flink");

	Set<Class<? extends TypeInformation>> typeInfos = reflections.getSubTypesOf(TypeInformation.class);

	Set<String> typeInfoTestNames = reflections.getSubTypesOf(TypeInformationTestBase.class)
			.stream().map(Class::getName).collect(Collectors.toSet());

	// check if a test exists for each type information
	for (Class<? extends TypeInformation> typeInfo : typeInfos) {
		// we skip abstract classes and inner classes to skip type information defined in test classes
		if (Modifier.isAbstract(typeInfo.getModifiers()) ||
				Modifier.isPrivate(typeInfo.getModifiers()) ||
				typeInfo.getName().contains("Test$") ||
				typeInfo.getName().contains("TestBase$") ||
				typeInfo.getName().contains("ITCase$") ||
				typeInfo.getName().contains("$$anon") ||
				typeInfo.getName().contains("queryablestate")) {
			continue;
		}

		final String testToFind = typeInfo.getName() + "Test";
		if (!typeInfoTestNames.contains(testToFind)) {
			fail("Could not find test '" + testToFind + "' that covers '" + typeInfo.getName() + "'.");
		}
	}
}
 
Example 3
Source Project: flink   Source File: TypeInfoTestCoverageTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTypeInfoTestCoverage() {
	Reflections reflections = new Reflections("org.apache.flink");

	Set<Class<? extends TypeInformation>> typeInfos = reflections.getSubTypesOf(TypeInformation.class);

	Set<String> typeInfoTestNames = reflections.getSubTypesOf(TypeInformationTestBase.class)
			.stream().map(Class::getName).collect(Collectors.toSet());

	// check if a test exists for each type information
	for (Class<? extends TypeInformation> typeInfo : typeInfos) {
		// we skip abstract classes and inner classes to skip type information defined in test classes
		if (Modifier.isAbstract(typeInfo.getModifiers()) ||
				Modifier.isPrivate(typeInfo.getModifiers()) ||
				typeInfo.getName().contains("Test$") ||
				typeInfo.getName().contains("TestBase$") ||
				typeInfo.getName().contains("ITCase$") ||
				typeInfo.getName().contains("$$anon") ||
				typeInfo.getName().contains("queryablestate")) {
			continue;
		}

		final String testToFind = typeInfo.getName() + "Test";
		if (!typeInfoTestNames.contains(testToFind)) {
			fail("Could not find test '" + testToFind + "' that covers '" + typeInfo.getName() + "'.");
		}
	}
}