mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 05:21:29 +07:00
[kotlin] Non-public methods/constructors could not be a test method
#KTIJ-26074 GitOrigin-RevId: 5e58ca42d2d20d03a52940d20f0aa6cf2c1ac742
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9c6ed68e17
commit
178415d0e6
@@ -126,9 +126,10 @@ public final class JUnitUtil {
|
||||
final PsiMethod psiMethod = location.getPsiElement();
|
||||
final PsiClass aClass = location instanceof MethodLocation ? ((MethodLocation)location).getContainingClass() : psiMethod.getContainingClass();
|
||||
if (checkClass && (aClass == null || !isTestClass(aClass, checkAbstract, true))) return false;
|
||||
if (psiMethod.isConstructor()) return false;
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.PRIVATE)) return false;
|
||||
if (isTestAnnotated(psiMethod, true)) return !psiMethod.hasModifierProperty(PsiModifier.STATIC);
|
||||
if (aClass != null && MetaAnnotationUtil.isMetaAnnotatedInHierarchy(aClass, Collections.singletonList(CUSTOM_TESTABLE_ANNOTATION))) return true;
|
||||
if (psiMethod.isConstructor()) return false;
|
||||
if (!psiMethod.hasModifierProperty(PsiModifier.PUBLIC)) return false;
|
||||
if (psiMethod.hasModifierProperty(PsiModifier.ABSTRACT)) return false;
|
||||
if (AnnotationUtil.isAnnotated(psiMethod, CONFIGURATIONS_ANNOTATION_NAME, 0)) return false;
|
||||
@@ -373,7 +374,7 @@ public final class JUnitUtil {
|
||||
|
||||
public static boolean isTestAnnotated(final PsiMethod method, boolean includeCustom) {
|
||||
if (isJUnit4TestAnnotated(method)) {
|
||||
return true;
|
||||
return method.hasModifierProperty(PsiModifier.PUBLIC);
|
||||
}
|
||||
|
||||
return MetaAnnotationUtil.isMetaAnnotated(method, includeCustom ? CUSTOM_TESTABLE_ANNOTATION_LIST : TEST5_JUPITER_ANNOTATIONS);
|
||||
|
||||
Reference in New Issue
Block a user