BigtableDataClientWrapper implements IBigtableDataClient { @Override public ApiFuture<List<Row>> readRowsAsync(Query request) { ListenableFuture<List<FlatRow>> responseProto = delegate.readFlatRowsAsync(request.toProto(requestContext)); return ApiFutureUtil.transformAndAdapt( responseProto, new Function<List<FlatRow>, List<Row>>() { @Override public List<Row> apply(List<FlatRow> flatRowList) { ImmutableList.Builder<Row> rowBuilder = ImmutableList.builderWithExpectedSize(flatRowList.size()); for (FlatRow flatRow : flatRowList) { rowBuilder.add(FlatRowConverter.convertToModelRow(flatRow)); } return rowBuilder.build(); } }); } 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 testReadRowsAsync() throws Exception { Query query = Query.create(TABLE_ID); FlatRow flatRow = FlatRow.newBuilder().withRowKey(ByteString.copyFromUtf8("key")).build(); List<FlatRow> listFlatRows = Arrays.asList(flatRow); when(client.readFlatRowsAsync(query.toProto(REQUEST_CONTEXT))) .thenReturn(Futures.immediateFuture(listFlatRows)); List<com.google.cloud.bigtable.data.v2.models.Row> actualResult = clientWrapper.readRowsAsync(query).get(); assertEquals(Arrays.asList(FlatRowConverter.convertToModelRow(flatRow)), actualResult); verify(client).readFlatRowsAsync(query.toProto(REQUEST_CONTEXT)); }