void () { final MyElement element = createElement("<a><child-element/><child/><child-element/></a>"); final Set<DomElement> visited = new HashSet<>(); element.acceptChildren(new DomElementVisitor() { @Override public void visitDomElement(DomElement element) { visited.add(element); } }); final MyElement foo = element.getFoo(); final MyElement child = element.getChild(); final MyElement child1 = element.getChildElements().get(0); final MyElement child2 = element.getChildElements().get(1); final GenericDomValue<Boolean> genericValue = element.getGenericValue(); assertSameElements(visited, foo, child, child1, child2, genericValue, element.getAttr()); }