@Test
public void testAdd() throws Exception {

  AccumulatingBatchReceiver<SimpleBatch> receiver =
      new AccumulatingBatchReceiver<>(ApiFutures.<Void>immediateFuture(null));
  ThresholdBatcher<SimpleBatch> batcher = createSimpleBatcherBuidler(receiver).build();
  batcher.add(SimpleBatch.fromInteger(14));
  assertThat(batcher.isEmpty()).isFalse();
  assertThat(receiver.getBatches()).hasSize(0);
  batcher.pushCurrentBatch().get();
  assertThat(batcher.isEmpty()).isTrue();
  assertThat(receiver.getBatches()).hasSize(1);
  assertThat(receiver.getBatches().get(0).getIntegers()).isEqualTo(Arrays.asList(14));
}