TestLocationDescriptor (@NotNull String testName, @NotNull VirtualFile matched, @NotNull Project project, @Nullable Module module) { if (testName.isEmpty()) return null; String path = matched.getPath(); int idx = StringUtil.indexOf(path, testName); boolean capitalized = StringUtil.isCapitalized(testName); boolean startWithLowerCase; if (idx < 0) { testName = capitalized ? StringUtil.decapitalize(testName) : StringUtil.capitalize(testName); idx = StringUtil.indexOf(path, testName); if (idx < 0) return null; startWithLowerCase = capitalized; } else { startWithLowerCase = !capitalized; } String pathPrefix = path.substring(0, idx); String pathSuffix = path.substring(idx + testName.length()); boolean isFromCurrentModule = false; if (module != null) { isFromCurrentModule = module.equals(ModuleUtilCore.findModuleForFile(matched, project)); } PsiFile file = PsiManager.getInstance(project).findFile(matched); if (file == null) return null; return new TestLocationDescriptor(pathPrefix, pathSuffix, startWithLowerCase, isFromCurrentModule, SmartPointerManager.getInstance(project).createSmartPsiElementPointer(file)); }