void () { configureByText(PlainTextFileType.INSTANCE, "foo bar goo\n"); SmartPsiElementPointer pointer = createPointer(myFile.getFirstChild()); GCWatcher.tracking(myFile.getNode()).ensureCollected(); assertEquals(myFile.getFirstChild(), pointer.getElement()); Document document = myFile.getViewProvider().getDocument(); ApplicationManager.getApplication().runWriteAction(() -> { document.deleteString(0, document.getTextLength()); GCWatcher.tracking(myFile.getNode()).ensureCollected(); assertEquals(myFile.getFirstChild(), pointer.getElement()); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); }); GCWatcher.tracking(myFile.getNode()).ensureCollected(); assertEquals(myFile.getFirstChild(), pointer.getElement()); }