DoubleIterator implements Iterator<T>, Serializable { @Override public T next() { if (this.current == 'x') throw FastNoSuchElementException.instance(); else { if (this.current == 'a') { this.current = 'b'; return this.a; } else { this.current = 'x'; return this.b; } } } protected  DoubleIterator(final T a, final T b); @Override boolean hasNext(); @Override void remove(); @Override T next();  }
@Test(expected = FastNoSuchElementException.class) public void shouldThrowFastNoSuchElementException() { final Iterator<String> itty = new DoubleIterator<>("test1", "test2"); itty.next(); itty.next(); itty.next(); }