void () { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText("<a><b/> </a>"); final XmlTag bTag = aTag.findFirstSubTag("b"); WriteCommandAction.runWriteCommandAction(null, () -> bTag.delete()); assertEquals(0, aTag.getSubTags().length); }