void () { ApplicationManager.getApplication().runWriteAction(() -> { PsiClass psiClass = myJavaFacade.findClass("p.A", GlobalSearchScope.allScope(myProject)); assertEquals("p.A", psiClass.getQualifiedName()); assertTrue(psiClass.isValid()); FileTypeManager fileTypeManager = FileTypeManager.getInstance(); String ignoredFilesList = fileTypeManager.getIgnoredFilesList(); fileTypeManager.setIgnoredFilesList(ignoredFilesList + ";p"); try { assertFalse(psiClass.isValid()); } finally { fileTypeManager.setIgnoredFilesList(ignoredFilesList); } psiClass = myJavaFacade.findClass("p.A"); assertTrue(psiClass.isValid()); }); }