boolean (@NotNull GlobalSearchScope globalSearchScope, @NotNull Project project, @NotNull JavaPsiFacade psiFacade) { PsiClass testEngine = psiFacade.findClass(JUnitCommonClassNames.ORG_JUNIT_PLATFORM_ENGINE_TEST_ENGINE, globalSearchScope); if (testEngine == null) return false; Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(PsiJavaModule.MODULE_INFO_FILE, globalSearchScope); if (!files.isEmpty() && ReferencesSearch.search(testEngine, GlobalSearchScope.filesScope(project, files)).anyMatch(ref -> isCustomEngineProvided(testEngine, ref))) { return true; } PsiManager psiManager = PsiManager.getInstance(project); GlobalSearchScope scope = GlobalSearchScope.getScopeRestrictedByFileTypes(globalSearchScope, SPIFileType.INSTANCE); return FilenameIndex.getVirtualFilesByName(JUnitCommonClassNames.ORG_JUNIT_PLATFORM_ENGINE_TEST_ENGINE, scope) .stream() .map(f -> psiManager.findFile(f)) .filter(Objects::nonNull) .flatMap(f -> PsiTreeUtil.findChildrenOfType(f, SPIClassProviderReferenceElement.class).stream()) .map(r -> r.resolve()) .filter(e -> e instanceof PsiClass) .map(e -> (PsiClass)e) .filter(c -> isCustomJunit5TestEngineName(c.getQualifiedName())) .anyMatch(c -> InheritanceUtil.isInheritorOrSelf(c, testEngine, true)); }