### Question:
FiniteGenerator extends AbstractGenerator<T> { @Override public T next() { mostRecentElement = iterator.next(); return mostRecentElement; } FiniteGenerator(Iterable<? extends T> iterable); @Override boolean hasNext(); @Override T next(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test(expected = NoSuchElementException.class) public void shouldThrowNoSuchElementExceptionOnceGeneratorExhausted() throws Exception { Iterable<Integer> backingValues = iterableWith(1); Generator<Integer> generator = new FiniteGenerator<Integer>(backingValues); generator.next(); generator.next(); }