String (@Nullable PsiClass psiClass) { if (psiClass == null) return null; return CachedValuesManager.getCachedValue(psiClass, () -> { final List<String> pathComponents = new ArrayList<>(); PsiClass currentPsiClass = psiClass; String testMetaData = null; String testDataPath = null; while (currentPsiClass != null) { testMetaData = testMetaData != null ? testMetaData : currentPsiClass.equals(psiClass) ? annotationValue(currentPsiClass, TestFrameworkConstants.TEST_METADATA_ANNOTATION_QUALIFIED_NAME) : null; String localTestDataPath = annotationValue(currentPsiClass, TestFrameworkConstants.TEST_DATA_PATH_ANNOTATION_QUALIFIED_NAME); testDataPath = localTestDataPath != null ? localTestDataPath : testDataPath; PsiClass containingClass = currentPsiClass.getContainingClass(); currentPsiClass = containingClass; } if (!StringUtil.isEmpty(testMetaData)) { pathComponents.add(testMetaData); } if (!StringUtil.isEmpty(testDataPath)) { pathComponents.add(testDataPath); } if (pathComponents.isEmpty()) return null; Collections.reverse(pathComponents); String path = FileUtil.toSystemIndependentName(Strings.join(pathComponents, File.separator)); return new CachedValueProvider.Result<>(path, PsiModificationTracker.MODIFICATION_COUNT); }); }