void () { final VirtualFile vFile = myFixture.addClass("class Foo {}").getContainingFile().getVirtualFile(); IdIndexEntry classEntry = new IdIndexEntry("class", true); FileBasedIndex.ValueProcessor<Integer> findValueProcessor = (file, value) -> !file.equals(vFile); GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject()); boolean result = FileBasedIndex.getInstance().processValues(IdIndex.NAME, classEntry, null, findValueProcessor, projectScope); assertFalse(result); final Document document = FileDocumentManager.getInstance().getDocument(vFile); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.setText("")); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); result = FileBasedIndex.getInstance().processValues(IdIndex.NAME, classEntry, null, findValueProcessor, projectScope); assertTrue(result); }