SingletonPrimitiveIteratorOfInt implements PrimitiveIterator.OfInt { @Override public Integer next() { if (!hasNext) { throw new NoSuchElementException(); } return nextInt(); } SingletonPrimitiveIteratorOfInt(int e); @Override boolean hasNext(); @Override int nextInt(); @Override Integer next(); @Override void remove(); @Override void forEachRemaining(IntConsumer action);  }
@Test void nextIntAfterNext() { instance.next(); assertThrows(NoSuchElementException.class, instance::nextInt); }
@Test void next() { assertEquals(ELEMENT, instance.next()); }
@Test void nextAfterNext() { instance.next(); assertThrows(NoSuchElementException.class, instance::next); }