@Test
public void testGetPushingBatcher() {

  BatchingSettings batchingSettings =
      BatchingSettings.newBuilder()
          .setDelayThreshold(Duration.ofSeconds(1))
          .setElementCountThreshold(2L)
          .setRequestByteThreshold(1000L)
          .build();
  FlowControlSettings flowControlSettings =
      FlowControlSettings.newBuilder()
          .setLimitExceededBehavior(LimitExceededBehavior.Ignore)
          .build();
  FlowController flowController = new FlowController(flowControlSettings);
  BatcherFactory<LabeledIntList, List<Integer>> batcherFactory =
      new BatcherFactory<>(
          new SquarerBatchingDescriptor(), batchingSettings, batchingExecutor, flowController);
  Truth.assertThat(batcherFactory.getBatchingSettings()).isSameInstanceAs(batchingSettings);
  ThresholdBatcher<Batch<LabeledIntList, List<Integer>>> batcherFoo =
      batcherFactory.getPushingBatcher(new PartitionKey("foo"));
  ThresholdBatcher<Batch<LabeledIntList, List<Integer>>> batcherFoo2 =
      batcherFactory.getPushingBatcher(new PartitionKey("foo"));
  ThresholdBatcher<Batch<LabeledIntList, List<Integer>>> batcherBar =
      batcherFactory.getPushingBatcher(new PartitionKey("bar"));
  Truth.assertThat(batcherFoo).isSameInstanceAs(batcherFoo2);
  Truth.assertThat(batcherFoo).isNotSameInstanceAs(batcherBar);
}