HasMany extends Relationship<List<T>> implements Iterable<ResourceIdentifier>, Serializable { @Override public List<T> get(Document document) { return get(document, null); } HasMany();  HasMany(ResourceIdentifier... resources); @Override List<T> get(Document document); List<T> get(Document document, T defaultValue); ResourceIdentifier get(int position); List<ResourceIdentifier> get(); @Override Iterator<ResourceIdentifier> iterator(); boolean add(ResourceIdentifier identifier); boolean add(String type, String id); boolean remove(ResourceIdentifier identifier); boolean remove(String type, String id); int size(); boolean hasData(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void resolution() { ObjectDocument document = new ObjectDocument(); Comment holder = new Comment(); assertThat(comments(2).get(document), hasItems(nullValue(Comment.class), nullValue(Comment.class))); assertThat(comments(2).get(document, holder), hasItems(holder, holder)); Comment[] comments = new Comment[] { new Comment(), new Comment() }; comments[0].setId("0"); comments[1].setId("1"); document.addInclude(comments[0]); assertThat(comments(2).get(document), hasItems(equalTo(comments[0]), nullValue(Comment.class))); document.addInclude(comments[1]); assertThat(comments(2).get(document), hasItems(comments[0], comments[1])); }