void () { Project project = getProject(); GlobalSearchScope allScope = GlobalSearchScope.allScope(project); assertNull(mySuite.getLocation(project, allScope)); mySuite.addChild(mySimpleTest); assertNull(mySuite.getLocation(project, allScope)); assertNull(mySimpleTest.getLocation(project, allScope)); PsiFile testFile = createFile("test.txt", MockTestLocator.TEST_LOCATION_TEXT); Location<PsiFile> testFileLocation = PsiLocation.fromPsiElement(testFile); MockTestLocator locator = new MockTestLocator(testFileLocation); mySimpleTest.setLocator(locator); assertEquals(testFileLocation, mySimpleTest.getLocation(project, allScope)); assertEquals(List.of(allScope), locator.myCalledSearchScopes); assertEquals(testFileLocation, mySimpleTest.getLocation(project, allScope)); assertEquals(List.of(allScope), locator.myCalledSearchScopes); GlobalSearchScope notAllScope = GlobalSearchScope.notScope(allScope); assertEquals(testFileLocation, mySimpleTest.getLocation(project, notAllScope)); assertEquals(List.of(allScope, notAllScope), locator.myCalledSearchScopes); WriteAction.run(() -> { PsiDocumentManager.getInstance(project).getDocument(testFile).setText(""); PsiDocumentManager.getInstance(project).commitAllDocuments(); // to rebuild PSI and invalidate cache }); assertNull(null, mySimpleTest.getLocation(project, allScope)); assertEquals(List.of(allScope, notAllScope, allScope), locator.myCalledSearchScopes); assertNull(null, mySimpleTest.getLocation(project, allScope)); assertEquals(List.of(allScope, notAllScope, allScope), locator.myCalledSearchScopes); assertNull(null, mySimpleTest.getLocation(project, allScope)); assertEquals(List.of(allScope, notAllScope, allScope), locator.myCalledSearchScopes); }