@Test public void testJankPage() { URI pageTwo = URI.create("http: List<ResourceLink> linksOne = Lists.newArrayList(new ResourceLink("next", pageTwo)); final ArrayList<String> strings = Lists.newArrayList(); final StringCollection jankCollection = new StringCollection(Lists.newArrayList(), linksOne, null); jankCollection.iterable().forEach(strings::add); final ArrayList<String> expected = Lists.newArrayList(); expected.addAll(itemsTwo); expected.addAll(itemsThree); assertTrue(strings.size() == expected.size()); assertEquals(lastItem, strings.get(strings.size() - 1)); assertEquals(expected, strings); assertTrue(StringCollection.twoCalled); assertTrue(StringCollection.threeCalled); }
public Iterable<T> iterable() { return new ResourceCollectionIterable<>(this); }
ResourceCollection { public Iterable<T> iterable() { return new ResourceCollectionIterable<>(this); } }
ResourceCollection { public Iterable<T> iterable() { return new ResourceCollectionIterable<>(this); } ResourceCollection(List<T> items, List<ResourceLink> links, NakadiClient client); }
ResourceCollection { public Iterable<T> iterable() { return new ResourceCollectionIterable<>(this); } ResourceCollection(List<T> items, List<ResourceLink> links, NakadiClient client); abstract ResourceCollection<T> fetchPage(String url); ResourceCollection<T> emptyPage(); ResourceCollection<T> nextPage(); List<T> items(); List<ResourceLink> links(); boolean hasNextLink(); Optional<URI> findLink(String rel); Iterable<T> iterable(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
ResourceCollection { public Iterable<T> iterable() { return new ResourceCollectionIterable<>(this); } ResourceCollection(List<T> items, List<ResourceLink> links, NakadiClient client); abstract ResourceCollection<T> fetchPage(String url); ResourceCollection<T> emptyPage(); ResourceCollection<T> nextPage(); List<T> items(); List<ResourceLink> links(); boolean hasNextLink(); Optional<URI> findLink(String rel); Iterable<T> iterable(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }