1package org.testng.junit; 2 3import java.lang.annotation.Annotation; 4import java.lang.reflect.Method; 5import org.junit.runner.RunWith; 6 7/** 8 * 9 * @author lukas 10 */ 11public final class JUnit4TestRecognizer implements JUnitTestRecognizer { 12 13 public JUnit4TestRecognizer() { 14 } 15 16 public boolean isTest(Class c) { 17 for (Annotation an: c.getAnnotations()) { 18 if (RunWith.class.isAssignableFrom(an.annotationType())) { 19 return true; 20 } 21 } 22 boolean haveTest = false; 23 for (Method m : c.getMethods()) { 24 for (Annotation a : m.getDeclaredAnnotations()) { 25 if (org.junit.Test.class.isAssignableFrom(a.annotationType())) { 26 haveTest = true; 27 break; 28 } 29 } 30 } 31 return haveTest; 32 } 33} 34