void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final MyElement child = createElement("<a><child/></a>").getChild(); incModCount(); child.ensureTagExists(); assertTrue(child.isValid()); assertNotNull(child.getXmlElement()); incModCount(); child.undefine(); assertTrue(child.isValid()); assertNull(child.getXmlElement()); child.ensureTagExists(); incModCount(); assertTrue(child.isValid()); assertNotNull(child.getXmlElement()); }); }