use of org.apache.drill.test.BaseTest in project drill by apache.
the class TestforBaseTestInheritance method verifyInheritance.
@Test
@Category(UnlikelyTest.class)
public void verifyInheritance() {
// Get all BaseTest inheritors
Reflections reflections = new Reflections("org.apache.drill", new SubTypesScanner(false));
Set<Class<? extends BaseTest>> baseTestInheritors = reflections.getSubTypesOf(BaseTest.class);
// Get all tests that are not inherited from BaseTest
Set<String> testClasses = reflections.getSubTypesOf(Object.class).stream().filter(c -> !c.isInterface()).filter(c -> c.getSimpleName().toLowerCase().contains("test")).filter(c -> Arrays.stream(c.getDeclaredMethods()).anyMatch(m -> m.getAnnotation(Test.class) != null)).filter(c -> !baseTestInheritors.contains(c)).map(Class::getName).collect(Collectors.toSet());
Assert.assertEquals("Found test classes that are not inherited from BaseTest:", Collections.emptySet(), testClasses);
}
Aggregations