void () { final XmlFile file = (XmlFile)createFile("file.xml", """ <?xml version='1.0' encoding='UTF-8'?> <a> <child> <child/> </child> </a>"""); final DomFileElementImpl<MyElement> fileElement = getDomManager().getFileElement(file, MyElement.class, "a"); myCallRegistry.clear(); final MyElement rootElement = fileElement.getRootElement(); final MyElement oldLeaf = rootElement.getChild().getChild(); final XmlTag oldLeafTag = oldLeaf.getXmlTag(); WriteCommandAction.runWriteCommandAction(getProject(), () -> { final Document document = getDocument(file); document.replaceString(0, document.getText().length(), "<a/>"); commitDocument(document); }); assertFalse(oldLeafTag.isValid()); putExpected(new DomEvent(fileElement, false)); assertResultsAndClear(); assertEquals(fileElement.getRootElement(), rootElement); assertTrue(rootElement.isValid()); assertFalse(oldLeaf.isValid()); assertTrue(rootElement.getChild().isValid()); assertNull(rootElement.getChild().getXmlTag()); assertNull(rootElement.getChild().getChild().getXmlTag()); }