@Test
public void testInvalidArguments() throws Exception {

  FlowController flowController =
      new FlowController(
          FlowControlSettings.newBuilder()
              .setMaxOutstandingElementCount(10L)
              .setMaxOutstandingRequestBytes(10L)
              .setLimitExceededBehavior(LimitExceededBehavior.Block)
              .build());
  flowController.reserve(0, 0);
  try {
    flowController.reserve(-1, 1);
    fail("Must have thrown an illegal argument error");
  } catch (IllegalArgumentException expected) {
    // Expected
  }
  try {
    flowController.reserve(1, -1);
    fail("Must have thrown an illegal argument error");
  } catch (IllegalArgumentException expected) {
    // Expected
  }
}