diff --git a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java index 918889a6b53f..a0dae9b674f6 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java +++ b/plugins/testng/src/com/theoryinpractice/testng/util/TestNGUtil.java @@ -203,7 +203,7 @@ public class TestNGUtil { } return true; } - if (element instanceof PsiDocCommentOwner && hasTestJavaDoc((PsiDocCommentOwner) element, checkJavadoc)) + if (element instanceof PsiDocCommentOwner && checkJavadoc && getTextJavaDoc((PsiDocCommentOwner)element) != null) return true; //now we check all methods for the test annotation if (element instanceof PsiClass) { @@ -217,7 +217,7 @@ public class TestNGUtil { return true; } if (AnnotationUtil.isAnnotated(method, FACTORY_ANNOTATION_FQN, false, true)) return true; - if (hasTestJavaDoc(method, checkJavadoc)) return true; + if (checkJavadoc && getTextJavaDoc(method) != null) return true; } return false; } else if (element instanceof PsiMethod) { @@ -231,7 +231,7 @@ public class TestNGUtil { boolean isPrivate = element.hasModifierProperty(PsiModifier.PRIVATE); return !isPrivate && !element.hasModifierProperty(PsiModifier.STATIC) && !hasConfig(element); } - else if (hasTestJavaDoc(psiClass, checkJavadoc)) return true; + else if (checkJavadoc && getTextJavaDoc(psiClass) != null) return true; } } return false; @@ -242,13 +242,6 @@ public class TestNGUtil { return attributeValue != null && attributeValue.textMatches("false"); } - private static boolean hasTestJavaDoc(@NotNull PsiDocCommentOwner element, final boolean checkJavadoc) { - if (checkJavadoc) { - return getTextJavaDoc(element) != null; - } - return false; - } - private static PsiDocTag getTextJavaDoc(@NotNull final PsiDocCommentOwner element) { final PsiDocComment docComment = element.getDocComment(); if (docComment != null) {