void () { final PsiFile psiFile = myFixture.addFileToProject("Foo.java", "class Foo {}"); GlobalSearchScope scope = GlobalSearchScope.allScope(getProject()); WriteCommandAction.runWriteCommandAction(getProject(), (Computable<PsiElement>)() -> psiFile.add(getElementFactory().createEnum("SomeEnum"))); WriteCommandAction.runWriteCommandAction(getProject(), (Computable<PsiElement>)() -> CodeStyleManager.getInstance(getProject()).reformat(psiFile)); assert JavaPsiFacade.getInstance(getProject()).findClass("Foo", scope) != null; long stamp = FileBasedIndex.getInstance().getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, getProject()); IdeaTestUtil.setModuleLanguageLevel(myFixture.getModule(), LanguageLevel.JDK_1_3); assert ((PsiJavaFile)psiFile).getImportList().getNode() != null; assert stamp != FileBasedIndex.getInstance().getIndexModificationStamp(StubUpdatingIndex.INDEX_ID, getProject()); }