testng: detect tests in "factory" classes (IDEA-78053)
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Mon, 30 Jan 2012 12:07:26 +0000 (16:07 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Mon, 30 Jan 2012 14:09:18 +0000 (18:09 +0400)
plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java

index 6e5d96ffc4bf5451f961d269648a1d2666798cf8..baf52860e7c7a2b816573f02aba2f133d7fe9f08 100644 (file)
@@ -93,6 +93,7 @@ public class TestNGUtil
   }
 
   public static final String TEST_ANNOTATION_FQN = Test.class.getName();
+  public static final String FACTORY_ANNOTATION_FQN = Factory.class.getName();
   public static final String[] CONFIG_ANNOTATIONS_FQN = {
       Configuration.class.getName(),
       Factory.class.getName(),
@@ -199,6 +200,7 @@ public class TestNGUtil
       PsiClass psiClass = (PsiClass) element;
       for (PsiMethod method : psiClass.getAllMethods()) {
         if (AnnotationUtil.isAnnotated(method, TEST_ANNOTATION_FQN, false, true)) return true;
+        if (AnnotationUtil.isAnnotated(method, FACTORY_ANNOTATION_FQN, false, true)) return true;
         if (hasTestJavaDoc(method, checkJavadoc)) return true;
       }
     } else if (element instanceof PsiMethod) {