@Test
  public void testAggregationNullResponse() throws Throwable {
    Table table = util.getConnection().getTable(TEST_TABLE);
    ColumnAggregationNullResponseSumRequest.Builder builder =
      ColumnAggregationNullResponseSumRequest.newBuilder();
    builder.setFamily(ByteString.copyFrom(TEST_FAMILY));
    if (TEST_QUALIFIER != null && TEST_QUALIFIER.length > 0) {
      builder.setQualifier(ByteString.copyFrom(TEST_QUALIFIER));
    }
    Map<byte[],
      ColumnAggregationNullResponseSumResponse> results = table.batchCoprocessorService(
        ColumnAggregationServiceNullResponse.getDescriptor().findMethodByName("sum"),
        builder.build(), ROWS[0], ROWS[ROWS.length - 1],
        ColumnAggregationNullResponseSumResponse.getDefaultInstance());

    long sumResult = 0;
    long expectedResult = 0;
    for (Map.Entry<byte[], ColumnAggregationNullResponseSumResponse> e : results.entrySet()) {
      LOG.info(
        "Got value " + e.getValue().getSum() + " for region " + Bytes.toStringBinary(e.getKey()));
      sumResult += e.getValue().getSum();
    }
    for (long i = 0; i < rowSeperator2; i++) {
      expectedResult += i;
    }
    assertEquals("Invalid result", expectedResult, sumResult);
    table.close();
  }
TestEndpoint: test cases to verify the batch execution of coprocessor Endpoint
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestBatchCoprocessorEndpoint.java