void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final MyElement element = createElement("<a>" + "<child>1</child>" + "<child attr=\"\">2</child>" + "</a>"); final MyElement child = element.getChild(); final MyElement child2 = element.getChild2(); assertTrue(child.isValid()); assertTrue(child2.isValid()); child.undefine(); assertTrue(child.isValid()); assertTrue(child2.isValid()); assertEquals(element, child.getParent()); assertEquals(element, child2.getParent()); assertEquals(child, element.getChild()); assertEquals(child2, element.getChild2()); myCallRegistry.putExpected(new DomEvent(child, false)); myCallRegistry.assertResultsAndClear(); XmlTag[] subTags = element.getXmlTag().getSubTags(); assertEquals(2, subTags.length); assertCached(child, subTags[0]); assertCached(child2, subTags[1]); }); }