mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
testng: do not mark as test if all tests are disabled
This commit is contained in:
@@ -25,7 +25,6 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.JarUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
@@ -191,21 +190,29 @@ public class TestNGUtil {
|
||||
if (element instanceof PsiClass) {
|
||||
PsiClass psiClass = (PsiClass) element;
|
||||
for (PsiMethod method : psiClass.getAllMethods()) {
|
||||
if (AnnotationUtil.isAnnotated(method, TEST_ANNOTATION_FQN, false, true)) return true;
|
||||
PsiAnnotation annotation = AnnotationUtil.findAnnotation(method, true, TEST_ANNOTATION_FQN);
|
||||
if (annotation != null) {
|
||||
if (checkDisabled) {
|
||||
if (isDisabled(annotation)) continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (AnnotationUtil.isAnnotated(method, FACTORY_ANNOTATION_FQN, false, true)) return true;
|
||||
if (hasTestJavaDoc(method, checkJavadoc)) return true;
|
||||
}
|
||||
return AnnotationUtil.isAnnotated(element, TEST_ANNOTATION_FQN, true, true);
|
||||
return false;
|
||||
} else if (element instanceof PsiMethod) {
|
||||
//if it's a method, we check if the class it's in has a global @Test annotation
|
||||
PsiClass psiClass = ((PsiMethod)element).getContainingClass();
|
||||
if (psiClass != null) {
|
||||
if (AnnotationUtil.isAnnotated(psiClass, TEST_ANNOTATION_FQN, true, true)) {
|
||||
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(psiClass, true, TEST_ANNOTATION_FQN);
|
||||
if (annotation != null) {
|
||||
if (checkDisabled && isDisabled(annotation)) return false;
|
||||
//even if it has a global test, we ignore private methods
|
||||
boolean isPrivate = element.hasModifierProperty(PsiModifier.PRIVATE);
|
||||
return !isPrivate && !element.hasModifierProperty(PsiModifier.STATIC) && !hasConfig(element);
|
||||
}
|
||||
if (hasTestJavaDoc(psiClass, checkJavadoc)) return true;
|
||||
else if (hasTestJavaDoc(psiClass, checkJavadoc)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user