Set<TestFramework> (PsiElement psiClass) { Set<TestFramework> frameworks = new LinkedHashSet<>(); Language classLanguage = psiClass.getLanguage(); Map<String, Language> checkedFrameworksByName = new HashMap<>(); for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) { String frameworkName = framework.getName(); Language frameworkLanguage = framework.getLanguage(); Language checkedFrameworkLanguage = checkedFrameworksByName.get(frameworkName); // if we've checked framework for more specific language - no reasons to check it again for more general language if (checkedFrameworkLanguage != null && isSubLanguage(checkedFrameworkLanguage, frameworkLanguage)) continue; if (!isSubLanguage(classLanguage, frameworkLanguage)) continue; if (framework.isTestClass(psiClass) || framework.findSetUpMethod(psiClass) != null || framework.findTearDownMethod(psiClass) != null) { frameworks.add(framework); } checkedFrameworksByName.put(frameworkName, frameworkLanguage); } return frameworks; }