### Question:
DocumentIterable implements Iterable<Document> { @Override public Iterator<Document> iterator() { if (!reversed) { return new DocumentIterator(documents); } else { return new ReverseDocumentIterator(documents); } } DocumentIterable(List<Document> documents); private  DocumentIterable(List<Document> documents, boolean reversed); @Override Iterator<Document> iterator();  }### Answer:
@Test void testIterateEmptyList() { DocumentIterable documentIterable = new DocumentIterable(Collections.emptyList()); assertThat(documentIterable.iterator().hasNext()).isFalse(); assertThatExceptionOfType(NoSuchElementException.class) .isThrownBy(() -> documentIterable.iterator().next()); }