boolean (PsiElement element) { if (!TestFramework.EXTENSION_NAME.hasAnyExtensions()) return false; if (element == null) return false; PsiClass psiClass = getContainingClass(element); if (psiClass == null) return false; PsiFile file = psiClass.getContainingFile(); if (file.getContainingDirectory() == null || JavaProjectRootsUtil.isOutsideJavaSourceRoot(file)) return false; if (psiClass.isAnnotationType() || psiClass instanceof PsiAnonymousClass) { return false; } return TestFrameworks.detectFramework(psiClass) == null; }