PsiReference (final String filePath) { VirtualFile testDataRoot = myFixture.getTestDataRoot(); assertNotNull(testDataRoot); final VirtualFile file = testDataRoot.findFileByRelativePath(filePath); assertNotNull(file); String fileText; try { fileText = StringUtil.convertLineSeparators(VfsUtilCore.loadText(file)); } catch (IOException e) { throw new RuntimeException(e); } int offset = fileText.indexOf(MARKER); assertTrue(offset >= 0); fileText = fileText.substring(0, offset) + fileText.substring(offset + MARKER.length()); final String finalFileText = fileText; myFixture.configureByText(new File(filePath).getName(), finalFileText); return myFixture.getFile().findReferenceAt(offset); }