@Override
  public void close() {
    client.close();
  }
@Test
  public void testWrite() throws IOException {
    doReturn(mockBatcher).when(mockBigtableDataClient).newBulkMutationBatcher((String) any());
    SettableApiFuture<Void> fakeFuture = SettableApiFuture.create();
    when(mockBatcher.closeAsync()).thenReturn(fakeFuture);
    ArgumentCaptor<RowMutationEntry> captor = ArgumentCaptor.forClass(RowMutationEntry.class);
    ApiFuture<Void> fakeResponse = SettableApiFuture.create();
    when(mockBatcher.add(any(RowMutationEntry.class)))
        .thenAnswer(
            invocation -> {
              fakeFuture.set(null);
              return fakeResponse;
            });

    BigtableService.Writer underTest =
        new BigtableServiceImpl.BigtableWriterImpl(
            mockBigtableDataClient,
            bigtableDataSettings.getProjectId(),
            bigtableDataSettings.getInstanceId(),
            TABLE_ID,
            Duration.millis(60000));

    ByteString key = ByteString.copyFromUtf8("key");
    Mutation mutation =
        Mutation.newBuilder()
            .setSetCell(
                Mutation.SetCell.newBuilder()
                    .setFamilyName("Family")
                    .setColumnQualifier(ByteString.copyFromUtf8("q"))
                    .setValue(ByteString.copyFromUtf8("value"))
                    .build())
            .build();

    underTest.writeRecord(KV.of(key, ImmutableList.of(mutation)));

    verify(mockBatcher).add(captor.capture());

    assertEquals(key, captor.getValue().toProto().getRowKey());
    assertTrue(captor.getValue().toProto().getMutations(0).hasSetCell());
    assertEquals(
        "Family", captor.getValue().toProto().getMutations(0).getSetCell().getFamilyName());
    underTest.close();
  }