CoverageAnalysis { public static boolean isTest(Class<?> cls) { if (Modifier.isAbstract(cls.getModifiers())) { return false; } TestClass tc; try { tc = new TestClass(cls); } catch (IllegalArgumentException e) { return false; } catch (RuntimeException e){ throw new RuntimeException("Failed to analyze class "+cls.getName()+ " due to: " + e.toString()); } try { List<FrameworkMethod> methods = new ArrayList<>(); methods.addAll(tc.getAnnotatedMethods(Test.class)); methods.addAll(tc.getAnnotatedMethods(EvoSuiteTest.class)); for (FrameworkMethod method : methods) { List<Throwable> errors = new ArrayList<>(); method.validatePublicVoidNoArg(false, errors); if (errors.isEmpty()) { return true; } } } catch (IllegalArgumentException e) { return false; } Class<?> superClass = cls; while ((superClass = superClass.getSuperclass()) != null) { if (superClass.getCanonicalName().equals(Object.class.getCanonicalName())) { break ; } else if (superClass.getCanonicalName().equals(TestCase.class.getCanonicalName())) { return true; } } return false; }  static void analyzeCoverage(); static Set<TestFitnessFunction> getCoveredGoals(Class<?> testClass, List<TestFitnessFunction> allGoals); static boolean isTest(Class<?> cls); void run();  }
@Test public void isTest() { assertFalse(CoverageAnalysis.isTest(Not_A_Test.class)); assertTrue(CoverageAnalysis.isTest(JUnit3Test.class)); assertFalse(CoverageAnalysis.isTest(JUnit3Suite.class)); assertFalse(CoverageAnalysis.isTest(AbstractJUnit3Test.class)); assertTrue(CoverageAnalysis.isTest(JUnit4Test.class)); assertTrue(CoverageAnalysis.isTest(JUnit4EvoSuiteTest.class)); assertFalse(CoverageAnalysis.isTest(JUnit4Suite.class)); assertFalse(CoverageAnalysis.isTest(JUnit4Categories.class)); assertTrue(CoverageAnalysis.isTest(JUnit4ParameterizedTest.class)); }