DataClientVeneerApi implements DataClientWrapper { @Override public ResultScanner readRows(Query request) { return new RowResultScanner(delegate.readRowsCallable(RESULT_ADAPTER).call(request)); } DataClientVeneerApi(BigtableDataClient delegate); @Override BulkMutationWrapper createBulkMutation(String tableId); @Override BulkReadWrapper createBulkRead(String tableId); @Override ApiFuture<Void> mutateRowAsync(RowMutation rowMutation); @Override ApiFuture<Result> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow); @Override ApiFuture<Boolean> checkAndMutateRowAsync(ConditionalRowMutation conditionalRowMutation); @Override ApiFuture<List<KeyOffset>> sampleRowKeysAsync(String tableId); @Override ApiFuture<Result> readRowAsync(
      String tableId, ByteString rowKey, @Nullable Filters.Filter filter); @Override ResultScanner readRows(Query request); @Override ApiFuture<List<Result>> readRowsAsync(Query request); @Override void readRowsAsync(Query request, StreamObserver<Result> observer); @Override void close();  }
@Test public void testReadRows() throws IOException { Query query = Query.create(TABLE_ID).rowKey(ROW_KEY); when(mockDataClient.readRowsCallable(Mockito.<RowResultAdapter>any())) .thenReturn(mockStreamingCallable) .thenReturn(mockStreamingCallable); when(serverStream.iterator()) .thenReturn( ImmutableList.of(Result.EMPTY_RESULT, EXPECTED_RESULT, EXPECTED_RESULT).iterator()) .thenReturn(ImmutableList.<Result>of().iterator()); when(mockStreamingCallable.call(query)).thenReturn(serverStream).thenReturn(serverStream); ResultScanner resultScanner = dataClientWrapper.readRows(query); assertResult(Result.EMPTY_RESULT, resultScanner.next()); assertResult(EXPECTED_RESULT, resultScanner.next()); doNothing().when(serverStream).cancel(); resultScanner.close(); ResultScanner noRowsResultScanner = dataClientWrapper.readRows(query); assertNull(noRowsResultScanner.next()); verify(serverStream).cancel(); verify(mockDataClient, times(2)).readRowsCallable(Mockito.<RowResultAdapter>any()); verify(serverStream, times(2)).iterator(); verify(mockStreamingCallable, times(2)).call(query); }