BufferIterator { public final int next() { if (hasNext()) { return Byte.toUnsignedInt(buffer.get(position++)); } else { throw new NoSuchElementException("Empty iterator"); } } BufferIterator(@NotNull Buffer buffer);  BufferIterator(@NotNull Buffer buffer, long offset, long size); final boolean hasNext(); final int next(); final int compareToPrefix(@NotNull BufferIterator prefix); static BufferIterator wrapCopy(@NotNull final Collection<Byte> bytes);  }
@Test(expected = NoSuchElementException.class) public void invalidNext() { new BufferIterator(Buffer.from(ByteBuffer.allocate(0))).next(); }