private static boolean isTestNGTestMethod(PsiMethod method) {
   final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
   for (TestFramework framework : testFrameworks) {
     if ("TestNG".equals(framework.getName())) {
       return framework.isTestMethod(method);
     }
   }
   return false;
 }
Exemplo n.º 2
0
 @Nullable
 public static TestFramework detectFramework(PsiClass psiClass) {
   for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
     if (framework.isTestClass(psiClass)) {
       return framework;
     }
   }
   return null;
 }
 @Override
 public boolean isTestClass(final PsiClass psiClass) {
   final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
   for (TestFramework framework : testFrameworks) {
     if (framework.isTestClass(psiClass)) {
       return true;
     }
   }
   return false;
 }
 @Override
 @Nullable
 public PsiMethod findSetUpMethod(final PsiClass psiClass) {
   final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
   for (TestFramework framework : testFrameworks) {
     if (framework.isTestClass(psiClass)) {
       final PsiMethod setUpMethod = (PsiMethod) framework.findSetUpMethod(psiClass);
       if (setUpMethod != null) {
         return setUpMethod;
       }
     }
   }
   return null;
 }
 @Override
 @Nullable
 public PsiMethod findOrCreateSetUpMethod(final PsiClass psiClass) {
   final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
   for (TestFramework framework : testFrameworks) {
     if (framework.isTestClass(psiClass)) {
       try {
         final PsiMethod setUpMethod = (PsiMethod) framework.findOrCreateSetUpMethod(psiClass);
         if (setUpMethod != null) {
           return setUpMethod;
         }
       } catch (IncorrectOperationException e) {
         // skip
       }
     }
   }
   return null;
 }