FluentBackoff { public FluentBackoff withMaxCumulativeBackoff(Duration maxCumulativeBackoff) { checkArgument( maxCumulativeBackoff.isLongerThan(Duration.ZERO), "maxCumulativeBackoff %s must be at least 1 millisecond", maxCumulativeBackoff); 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 testInvalidCumulativeBackoff() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("maxCumulativeBackoff PT-0.002S must be at least 1 millisecond"); defaultBackoff.withMaxCumulativeBackoff(Duration.millis(-2)); }