void () { final MyElement element = createPhysicalElement("<a>" + "<child/>" + "<child><child/></child>" + "<child/></a>"); final MyElement child = element.getChild(); final MyElement child2 = element.getChild2(); final XmlTag leafTag = child2.getChild().getXmlTag(); WriteCommandAction.runWriteCommandAction(getProject(), () -> { element.getXmlTag().addAfter(createTag("<child/>"), child.getXmlTag()); }); assertNoCache(leafTag); final XmlTag[] subTags = element.getXmlTag().getSubTags(); assertFalse(child2.isValid()); assertEquals(child, element.getChild()); assertFalse(child2.equals(element.getChild2())); assertCached(child, subTags[0]); assertNoCache(subTags[2]); assertNoCache(subTags[3]); putExpected(new DomEvent(element, false)); putExpected(new DomEvent(element, false)); assertResultsAndClear(); }