@Test
  public void testMedianWithNoResults() throws Exception {
    AggregateRequest request = AggregateRequest.newBuilder().setScan(ProtobufUtil.toScan(scan))
      .setInterpreterClassName(LongColumnInterpreter.class.getName())
      .setClientSupportsPartialResult(false).build();

    ArgumentCaptor<AggregateResponse> responseCaptor =
      ArgumentCaptor.forClass(AggregateResponse.class);
    RpcCallback<AggregateResponse> callback = mock(RpcCallback.class);

    doAnswer(invocation -> false).when(scanner).next(any(List.class));

    aggregate.getMedian(controller, request, callback);

    verify(callback).run(responseCaptor.capture());

    AggregateResponse response = responseCaptor.getValue();

    assertNull(response);
  }
Test AggregateImplementation with throttling and partial results
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestAggregateImplementation.java