SingleIterator implements Iterator<T>, Serializable { @Override public T next() { if (!this.alive) throw FastNoSuchElementException.instance(); else { this.alive = false; return t; } } protected  SingleIterator(final T t); @Override boolean hasNext(); @Override void remove(); @Override T next();  }
@Test(expected = FastNoSuchElementException.class) public void shouldThrowFastNoSuchElementException() { final Iterator<String> itty = new SingleIterator<>("test1"); itty.next(); itty.next(); }