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

The following examples show how to use org.apache.flink.api.common.typeutils.TypeInformationTestBase. 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: TypeInfoTestCoverageTest.java    From Flink-CEPplus with 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 File: TypeInfoTestCoverageTest.java    From flink with 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 File: TypeInfoTestCoverageTest.java    From flink with 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() + "'.");
		}
	}
}