InternalResult implements Result { @Override public List<Record> list() { return blockingGet( cursor.listAsync() ); } 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 shouldList() { Result result = createResult( 2 ); List<String> records = result.list( column( "k1", ofString() ) ); assertThat( records, equalTo( asList( "v1-1", "v1-2" ) ) ); }
@Test void shouldListTwice() { Result result = createResult( 2 ); List<Record> firstList = result.list(); assertThat( firstList.size(), equalTo( 2 ) ); List<Record> secondList = result.list(); assertThat( secondList.size(), equalTo( 0 ) ); }