@Test
public void testExceptionWithNullFlowController() {

  try {
    ThresholdBatcher.<SimpleBatch>newBuilder()
        .setThresholds(BatchingThresholds.<SimpleBatch>create(100))
        .setExecutor(EXECUTOR)
        .setMaxDelay(Duration.ofMillis(10000))
        .setReceiver(
            new AccumulatingBatchReceiver<SimpleBatch>(ApiFutures.<Void>immediateFuture(null)))
        .setBatchMerger(new SimpleBatchMerger())
        .build();
    Assert.fail("ThresholdBatcher should have thrown an exception");
  } catch (NullPointerException expected) {
    assertThat(expected).isInstanceOf(NullPointerException.class);
  }
}