SingleIterator implements SizedIterator<OBJECT> { @Override public OBJECT next() { if (this.object != null) { final OBJECT obj = this.object; this.object = null; return obj; } throw new NoSuchElementException(); } SingleIterator(OBJECT obj); @Pure @Override boolean hasNext(); @Override OBJECT next(); @Pure @Override int index(); @Pure @Override int totalSize(); @Pure @Override int rest();  }
@Test public void next() { assertSame(this.s1, this.iterator.next()); try { this.iterator.next(); fail("expecting NoSuchElementException"); } catch(NoSuchElementException exception) { } }