private void checkValidInterval(Duration pollingInterval,int retries,long timeSleptMillis){
  long highSum=0;
  long lowSum=0;
  for (int i=0; i < retries; i++) {
    double currentInterval=pollingInterval.getMillis() * Math.pow(DataflowPipelineJob.DEFAULT_BACKOFF_EXPONENT,i);
    double randomOffset=0.5 * currentInterval;
    highSum+=Math.round(currentInterval + randomOffset);
    lowSum+=Math.round(currentInterval - randomOffset);
  }
  assertThat(timeSleptMillis,allOf(greaterThanOrEqualTo(lowSum),lessThanOrEqualTo(highSum)));
}

private void checkValidInterval ( Duration pollingInterval , int retries , long timeSleptMillis ) { long highSum = 0 ; long lowSum = 0 ; for ( int i = 0 ; i < retries ; i ++ ) { double currentInterval = pollingInterval . getMillis ( ) * Math . pow ( DataflowPipelineJob . DEFAULT_BACKOFF_EXPONENT , i ) ; double randomOffset = 0.5 * currentInterval ; highSum += Math . round ( currentInterval + randomOffset ) ; lowSum += Math . round ( currentInterval - randomOffset ) ; } assertThat ( timeSleptMillis , allOf ( greaterThanOrEqualTo ( lowSum ) , lessThanOrEqualTo ( highSum ) ) ) ; }
validates that a given time is valid for the total time slept by a attemptboundedexponentialbackoff given the number of retries and an initial polling interval .
