BigtableDataClientWrapper implements IBigtableDataClient { @Override public Boolean checkAndMutateRow(ConditionalRowMutation conditionalRowMutation) { CheckAndMutateRowResponse response = delegate.checkAndMutateRow(conditionalRowMutation.toProto(requestContext)); return response.getPredicateMatched(); } 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 testCheckMutateRow() { Mutation mutation = Mutation.create(); mutation.setCell("family", "qualifier", "some other value"); ConditionalRowMutation conditonalMutation = ConditionalRowMutation.create(TABLE_ID, "first" + "-row" + "-key").then(mutation); CheckAndMutateRowRequest request = conditonalMutation.toProto(REQUEST_CONTEXT); CheckAndMutateRowResponse response = CheckAndMutateRowResponse.newBuilder().setPredicateMatched(true).build(); when(client.checkAndMutateRow(request)).thenReturn(response); Boolean actual = clientWrapper.checkAndMutateRow(conditonalMutation); verify(client).checkAndMutateRow(request); assertTrue(actual); }
@Test public void testCheckMutateRowWhenNoPredicateMatch() { Mutation mutation = Mutation.create(); mutation.setCell("family", "qualifier", "some other value"); ConditionalRowMutation conditonalMutation = ConditionalRowMutation.create(TABLE_ID, "first" + "-row" + "-key").then(mutation); CheckAndMutateRowRequest request = conditonalMutation.toProto(REQUEST_CONTEXT); CheckAndMutateRowResponse response = CheckAndMutateRowResponse.newBuilder().setPredicateMatched(false).build(); when(client.checkAndMutateRow(request)).thenReturn(response); Boolean actual = clientWrapper.checkAndMutateRow(conditonalMutation); verify(client).checkAndMutateRow(request); assertFalse(actual); }