void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final MyElement element = createElement("<a/>"); final MyElement child = element.getChild(); child.undefine(); myCallRegistry.assertResultsAndClear(); assertTrue(child.isValid()); assertEquals(0, element.getXmlTag().getSubTags().length); assertSame(element, child.getParent()); }); }