void () { WriteCommandAction.writeCommandAction(getProject()).run(() -> { final MyElement element = createElement("<a>" + "<child>1</child>" + "<child attr=\"\">2</child>" + "<child/></a>"); final MyElement child = element.getChild(); final MyElement child2 = element.getChild2(); assertEquals("", child2.getAttr().getValue()); assertTrue(child.isValid()); assertTrue(child2.isValid()); child.undefine(); assertTrue(child.isValid()); assertTrue(child2.isValid()); assertTrue(child2.equals(element.getChild2())); assertNotNull(child.getXmlTag()); child2.undefine(); assertTrue(child.isValid()); assertTrue(child2.isValid()); assertTrue(child2.equals(element.getChild2())); assertEquals(child, element.getChild()); assertEquals("", child.getValue()); assertNull(element.getChild2().getValue()); myCallRegistry.putExpected(new DomEvent(child, false)); myCallRegistry.putExpected(new DomEvent(child2, false)); myCallRegistry.assertResultsAndClear(); }); }