/** @return true if {@param cls} is {@link JUnit4} annotated. */
 protected boolean isJUnit4TestClass(Class cls) {
   // Need to find test classes, otherwise crashes with b/11790448.
   if (!cls.getName().endsWith("Test")) {
     return false;
   }
   // Check the annotations.
   Annotation annotation = cls.getAnnotation(RunWith.class);
   if (annotation != null) {
     RunWith runWith = (RunWith) annotation;
     Object value = runWith.value();
     if (value.equals(JUnit4.class) || value.equals(Suite.class)) {
       return true;
     }
   }
   return false;
 }
Example #2
0
 /**
  * Classes that have a {@code RunWith} annotation for {@link ClasspathSuite} or {@link
  * CustomSuite} are automatically excluded to avoid picking up the suite class itself.
  */
 private static boolean isSuite(Class<?> container) {
   RunWith runWith = container.getAnnotation(RunWith.class);
   return (runWith != null)
       && ((runWith.value() == ClasspathSuite.class) || (runWith.value() == CustomSuite.class));
 }