void () { ProjectRootManagerEx rootManager = (ProjectRootManagerEx)ProjectRootManager.getInstance(myProject); final VirtualFile root = rootManager.getContentRoots()[0]; ensureCachesAreUpToDate(); WriteCommandAction.writeCommandAction(getProject()).run(() -> { VirtualFile newFile = createChildData(root, "New.java"); setFileText(newFile, "class A{ Exception e;} //todo"); }); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); ensureCachesAreUpToDate(); PsiTestUtil.addExcludedRoot(myModule, root); PsiClass exceptionClass = myJavaFacade.findClass("java.lang.Exception", GlobalSearchScope.allScope(getProject())); assertNotNull(exceptionClass); checkUsages(exceptionClass, ArrayUtil.EMPTY_STRING_ARRAY); checkTodos(ArrayUtil.EMPTY_STRING_ARRAY); }