public FluentBackoff withMaxRetries(int maxRetries) {
    checkArgument(maxRetries >= 0, "maxRetries %s cannot be negative", maxRetries);
    return new FluentBackoff(
        exponent,
        initialBackoff,
        maxBackoff,
        maxCumulativeBackoff,
        maxRetries,
        throttledTimeCounter);
  }
@Test
  public void testInvalidMaxRetries() {
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("maxRetries -1 cannot be negative");
    defaultBackoff.withMaxRetries(-1);
  }