InternalResult implements Result { @Override public Record next() { Record record = blockingGet( cursor.nextAsync() ); if ( record == null ) { throw new NoSuchRecordException( "No more records" ); } return record; } InternalResult(Connection connection, ResultCursor cursor ); @Override List<String> keys(); @Override boolean hasNext(); @Override Record next(); @Override Record single(); @Override Record peek(); @Override Stream<Record> stream(); @Override List<Record> list(); @Override List<T> list( Function<Record, T> mapFunction ); @Override ResultSummary consume(); @Override void remove();  }
@Test void singlePastFirstShouldFail() { Result result = createResult( 2 ); result.next(); result.next(); assertThrows( NoSuchRecordException.class, result::single ); }