void () { VirtualFile vfile = createChildData(myRoot, "X.java"); @Language("JAVA") String text = "public class X { public int X; }"; setFileText(vfile, text); PsiClass aClass = myJavaFacade.findClass("X", GlobalSearchScope.allScope(getProject())); assertNotNull(aClass); assertTrue(aClass.isValid()); PsiFileImpl file = (PsiFileImpl)aClass.getContainingFile(); assertTreeLoaded(file, false); SmartPsiElementPointer p = createPointer(aClass); assertNotNull(p); assertTreeLoaded(file, false); assertInstanceOf(p.getElement(), PsiClass.class); assertTreeLoaded(file, false); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); Document document = documentManager.getDocument(file); insertString(document, 0, "/** asdasd */"); documentManager.commitAllDocuments(); // loaded tree assertTreeLoaded(file, true); assertInstanceOf(p.getElement(), PsiClass.class); assertTreeLoaded(file, true); }