void () { final MyElement element = createElement("<a><child-element/></a>"); final DomGenericInfo info = element.getGenericInfo(); final DomCollectionChildDescription collectionChild = info.getCollectionChildDescription("child-element"); final List<? extends DomElement> values = collectionChild.getValues(element); MyElement newChild = (MyElement) collectionChild.addValue(element); List<DomElement> newChildren = Arrays.asList(values.get(0), newChild); assertEquals(newChildren, element.getChildElements()); assertEquals(newChildren, collectionChild.getValues(element)); MyElement lastChild = (MyElement) collectionChild.addValue(element, 0); newChildren = Arrays.asList(lastChild, values.get(0), newChild); assertEquals(newChildren, element.getChildElements()); assertEquals(newChildren, collectionChild.getValues(element)); }