boolean (@NotNull PsiElement psiElement) { if (psiElement instanceof PsiClass) { final PsiClass aClass = (PsiClass)psiElement; if (JUnitUtil.isTestClass(aClass, false, true)) { final boolean isJUnit5 = JUnitUtil.isJUnit5(aClass); if (!PsiClassUtil.isRunnableClass(aClass, !isJUnit5, true)) { final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(aClass, PsiClass.class); if (topLevelClass != null && PsiClassUtil.isRunnableClass(topLevelClass, !isJUnit5, true)) { return true; } final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<>() { @Override protected boolean accept(PsiClass psiClass) { return !psiClass.hasModifierProperty(PsiModifier.ABSTRACT); } }; return !ClassInheritorsSearch.search(aClass).forEach(findProcessor) && findProcessor.isFound(); } return true; } } else if (psiElement instanceof PsiMethod method) { if (method.isConstructor() && method.getParameterList().isEmpty()) { final PsiClass aClass = method.getContainingClass(); return aClass != null && JUnitUtil.isTestClass(aClass); } if (JUnitUtil.isTestMethodOrConfig(method)) return true; } else if (psiElement instanceof PsiField) { return AnnotationUtil.isAnnotated((PsiField)psiElement, FIELD_ANNOTATIONS, 0); } return false; }