### Question:
SegmentIterator implements KeyValueIterator<Bytes, byte[]> { public KeyValue<Bytes, byte[]> next() { if (!hasNext()) { throw new NoSuchElementException(); } return currentIterator.next(); } SegmentIterator(final Iterator<Segment> segments,
                    final HasNextCondition hasNextCondition,
                    final Bytes from,
                    final Bytes to); void close(); @Override Bytes peekNextKey(); @Override boolean hasNext(); KeyValue<Bytes, byte[]> next(); void remove();  }### Answer:
@Test(expected = NoSuchElementException.class) public void shouldThrowNoSuchElementOnNextIfNoNext() throws Exception { iterator = new SegmentIterator(Arrays.asList(segmentOne, segmentTwo).iterator(), hasNextCondition, Bytes.wrap("f".getBytes()), Bytes.wrap("h".getBytes())); iterator.next(); }