BigtableDataClientWrapper implements IBigtableDataClient { @Override public ResultScanner<Row> readRows(Query request) { final ResultScanner<FlatRow> delegate = readFlatRows(request); return new ResultScanner<Row>() { @Override public Row next() throws IOException { return FlatRowConverter.convertToModelRow(delegate.next()); } @Override public Row[] next(int count) throws IOException { FlatRow[] flatRows = delegate.next(count); Row[] rows = new Row[flatRows.length]; for (int i = 0; i < flatRows.length; i++) { rows[i] = FlatRowConverter.convertToModelRow(flatRows[i]); } return rows; } @Override public void close() throws IOException { delegate.close(); } @Override public int available() { return delegate.available(); } }; } BigtableDataClientWrapper(
      BigtableDataClient bigtableDataClient, RequestContext requestContext); @Override void mutateRow(RowMutation rowMutation); @Override ApiFuture<Void> mutateRowAsync(RowMutation rowMutation); @Override Row readModifyWriteRow(ReadModifyWriteRow readModifyWriteRow); @Override ApiFuture<Row> readModifyWriteRowAsync(ReadModifyWriteRow readModifyWriteRow); @Override IBulkMutation createBulkMutationBatcher(String tableId); @Override ApiFuture<Boolean> checkAndMutateRowAsync(ConditionalRowMutation conditionalRowMutation); @Override Boolean checkAndMutateRow(ConditionalRowMutation conditionalRowMutation); @Override List<KeyOffset> sampleRowKeys(String tableId); @Override ApiFuture<List<KeyOffset>> sampleRowKeysAsync(String tableId); @Override ResultScanner<Row> readRows(Query request); @Override ApiFuture<List<Row>> readRowsAsync(Query request); @Override List<FlatRow> readFlatRowsList(Query request); @Override ResultScanner<FlatRow> readFlatRows(Query request); @Override ApiFuture<List<FlatRow>> readFlatRowsAsync(Query request); @Override void readFlatRowsAsync(Query request, StreamObserver<FlatRow> observer);  }
@Test public void testReadRows() throws Exception { Query query = Query.create(TABLE_ID); FlatRow row = FlatRow.newBuilder().withRowKey(ByteString.copyFromUtf8("key")).build(); when(client.readFlatRows(query.toProto(REQUEST_CONTEXT))).thenReturn(mockFlatRow); when(mockFlatRow.next()).thenReturn(row); ResultScanner<com.google.cloud.bigtable.data.v2.models.Row> actualResult = clientWrapper.readRows(query); assertEquals(FlatRowConverter.convertToModelRow(row), actualResult.next()); verify(mockFlatRow).next(); verify(client).readFlatRows(query.toProto(REQUEST_CONTEXT)); }