void () { final MyElement element = createElement("<a><child-element/></a>"); assertEquals(1, element.getChildElements().size()); final MyElement firstChild = element.getChildElements().get(0); final XmlTag firstChildTag = element.getXmlTag().findSubTags("child-element")[0]; assertCached(firstChild, firstChildTag); final MyElement child = element.addChildElement(); assertEquals(Arrays.asList(firstChild, child), element.getChildElements()); final XmlTag childTag = element.getXmlTag().findSubTags("child-element")[1]; putExpected(new DomEvent(element, false)); final DomElement element1 = child.getAttr(); putExpected(new DomEvent(element1, true)); final DomElement element2 = child.isGenericValue(); putExpected(new DomEvent(element2, true)); final MyElement newChild = element.addChildElement(1); assertEquals(Arrays.asList(firstChild, newChild, child), element.getChildElements()); final XmlTag newChildTag = element.getXmlTag().findSubTags("child-element")[1]; putExpected(new DomEvent(element, false)); final DomElement element3 = newChild.getAttr(); putExpected(new DomEvent(element3, true)); final DomElement element4 = newChild.isGenericValue(); putExpected(new DomEvent(element4, true)); final MyElement lastChild = element.addChildElement(239); assertEquals(Arrays.asList(firstChild, newChild, child, lastChild), element.getChildElements()); final XmlTag lastChildTag = element.getXmlTag().findSubTags("child-element")[3]; putExpected(new DomEvent(element, false)); final DomElement element5 = lastChild.getAttr(); putExpected(new DomEvent(element5, true)); final DomElement element6 = lastChild.isGenericValue(); putExpected(new DomEvent(element6, true)); assertResultsAndClear(); assertCached(firstChild, firstChildTag); assertCached(newChild, newChildTag); assertCached(child, childTag); assertCached(lastChild, lastChildTag); assertSame(firstChildTag, element.getXmlTag().findSubTags("child-element")[0]); assertSame(newChildTag, element.getXmlTag().findSubTags("child-element")[1]); assertSame(childTag, element.getXmlTag().findSubTags("child-element")[2]); assertSame(lastChildTag, element.getXmlTag().findSubTags("child-element")[3]); }