DescribedCollection implements Iterable<T> { public Collection<T> items() { return Collections.unmodifiableCollection(items); } 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 shouldReturnImmutableCollectionOfItems() { DescribedCollection<String> collection = new DescribedCollection<String>(RepositoryName.from("repository"), "1"); Collection<String> collectionItems = collection.items(); catchException(collectionItems).add("2"); assertThat(caughtException()).isInstanceOf(UnsupportedOperationException.class); }