public void assertDurationIsInRange(long expectedMillis){
  long minimum=(long)((double)expectedMillis * 0.90);
  long maximum=Math.max((long)((double)expectedMillis * 1.10),10);
  long waitMillis=Math.max(expectedMillis * 10,10);
  long duration=getDurationMillis(waitMillis);
  if (duration < minimum) {
    Assert.fail("expected duration: " + expectedMillis + " minimum duration: "+ minimum+ " actual duration too short: "+ duration);
  }
 else   if (duration > maximum) {
    Assert.fail("expected duration: " + expectedMillis + " maximum duration: "+ maximum+ " actual duration too long: "+ duration);
  }
}

public void assertDurationIsInRange ( long expectedMillis ) { long minimum = ( long ) ( ( double ) expectedMillis * 0.90 ) ; long maximum = Math . max ( ( long ) ( ( double ) expectedMillis * 1.10 ) , 10 ) ; long waitMillis = Math . max ( expectedMillis * 10 , 10 ) ; long duration = getDurationMillis ( waitMillis ) ; if ( duration < minimum ) { Assert . fail ( "expected duration: " + expectedMillis + " minimum duration: " + minimum + " actual duration too short: " + duration ) ; } else if ( duration > maximum ) { Assert . fail ( "expected duration: " + expectedMillis + " maximum duration: " + maximum + " actual duration too long: " + duration ) ; } }
asserts that the actual duration is within 10 % of the given expected time .
