FluentBackoff { public FluentBackoff withMaxRetries(int maxRetries) { checkArgument(maxRetries >= 0, "maxRetries %s cannot be negative", maxRetries); return new FluentBackoff( exponent, initialBackoff, maxBackoff, maxCumulativeBackoff, maxRetries); } private  FluentBackoff(
      double exponent,
      Duration initialBackoff,
      Duration maxBackoff,
      Duration maxCumulativeBackoff,
      int maxRetries); BackOff backoff(); FluentBackoff withExponent(double exponent); FluentBackoff withInitialBackoff(Duration initialBackoff); FluentBackoff withMaxBackoff(Duration maxBackoff); FluentBackoff withMaxCumulativeBackoff(Duration maxCumulativeBackoff); FluentBackoff withMaxRetries(int maxRetries); @Override String toString(); static final FluentBackoff DEFAULT; }
@Test public void testInvalidMaxRetries() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("maxRetries -1 cannot be negative"); defaultBackoff.withMaxRetries(-1); }