### Question:
AbstractUberNode implements Iterable<UberNode> { public void addData(UberNode item) { data.add(item); } AbstractUberNode(); @JsonInclude(Include.NON_EMPTY) List<UberNode> getData(); void addData(UberNode item); void addLink(Link link); void addLinks(Iterable<Link> links); UberNode getFirstByName(String name); UberNode getFirstByRel(String rel); @Override Iterator<UberNode> iterator();  }### Answer:
@Test public void iteratesInOrder() throws Exception { dummyUberNode.addData(bar); dummyUberNode.addData(foo); dummyUberNode.addData(baz); int i = 0; String[] expected = {"bar", "foo", "baz"}; for (UberNode uberNode : dummyUberNode) { assertEquals(expected[i++], uberNode.getName()); } }
@Test public void iteratesOverData() throws Exception { dummyUberNode.addData(foo); dummyUberNode.addData(bar); int i = 0; String[] expected = {"foo", "bar",}; for (UberNode uberNode : dummyUberNode) { assertEquals(expected[i++], uberNode.getName()); } }