void () { VirtualFile file = myFixture.addFileToProject("../src2/A.java", "class A {}").getVirtualFile(); LanguageLevel level = JavaLanguageLevelPusher.getPushedLanguageLevel(file); assertFalse(ProjectFileIndex.getInstance(getProject()).isInSourceContent(file)); assertNull(level); assertFalse(JavaParserDefinition.JAVA_FILE.shouldBuildStubFor(file)); assertNull(getIndexedStub(file)); PsiTestUtil.addSourceContentToRoots(myFixture.getModule(), file.getParent()); try { LanguageLevel level2 = JavaLanguageLevelPusher.getPushedLanguageLevel(file); assertTrue(ProjectFileIndex.getInstance(getProject()).isInSourceContent(file)); assertEquals(LanguageLevel.HIGHEST, level2); assertTrue(JavaParserDefinition.JAVA_FILE.shouldBuildStubFor(file)); assertNotNull(getIndexedStub(file)); } finally { PsiTestUtil.removeSourceRoot(myFixture.getModule(), file.getParent()); } }