DescribedCollection implements Iterable<T> { public T firstItem() { return items.iterator().next(); } DescribedCollection(RepositoryName source, Collection<T> items);  DescribedCollection(RepositoryName source, T... items); RepositoryName source(); Collection<T> items(); List<T> itemsList(); T firstItem(); boolean isEmpty(); @Override Iterator<T> iterator();  }
@Test public void shouldReturnFristItemInIterationOrderWhenAskingForFirstItem() { DescribedCollection<String> collection = new DescribedCollection<String>(RepositoryName.from("repository"), "1", "2"); String item = collection.firstItem(); assertThat(item).isEqualTo("1"); }