@Test
public void testSampleRowKeysAsync() throws Exception {

  final ByteString ROW_KEY_1 = ByteString.copyFromUtf8("row-key-1");
  final ByteString ROW_KEY_2 = ByteString.copyFromUtf8("row-key-2");
  final ByteString ROW_KEY_3 = ByteString.copyFromUtf8("row-key-3");
  String tableName = NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID);
  SampleRowKeysRequest requestProto =
      SampleRowKeysRequest.newBuilder().setTableName(tableName).build();
  ImmutableList.Builder sampleKeys = ImmutableList.builder();
  sampleKeys.add(
      SampleRowKeysResponse.newBuilder().setRowKey(ROW_KEY_1).setOffsetBytes(11).build());
  sampleKeys.add(
      SampleRowKeysResponse.newBuilder().setRowKey(ROW_KEY_2).setOffsetBytes(12).build());
  sampleKeys.add(
      SampleRowKeysResponse.newBuilder().setRowKey(ROW_KEY_3).setOffsetBytes(13).build());
  List<SampleRowKeysResponse> responseProtos = sampleKeys.build();
  when(client.sampleRowKeysAsync(requestProto))
      .thenReturn(Futures.immediateFuture(responseProtos));
  List<KeyOffset> keyOffsetList = clientWrapper.sampleRowKeysAsync(TABLE_ID).get();
  assertEquals(keyOffsetList.get(0).getKey(), ROW_KEY_1);
  assertEquals(keyOffsetList.get(1).getKey(), ROW_KEY_2);
  assertEquals(keyOffsetList.get(2).getKey(), ROW_KEY_3);
  verify(client).sampleRowKeysAsync(requestProto);
}