@Test public void at_first_yields() { waitStrategy = new SpiedProgressiveSleepWaitStrategy(3, 1, 10); for (int i = 0; i < 3; i++) { waitStrategy.snooze(); } assertThat(spy, is(asList("yield", "yield", "yield"))); }
@Override public void snooze() { if (invocations < yieldCount) { yield(); invocations++; } else { int millis = invocations - yieldCount + initialSleepMillis; sleep(millis); if (millis < maxSleepMillis) { invocations++; } } }
ProgressiveSleepWaitStrategy implements WaitStrategy { @Override public void snooze() { if (invocations < yieldCount) { yield(); invocations++; } else { int millis = invocations - yieldCount + initialSleepMillis; sleep(millis); if (millis < maxSleepMillis) { invocations++; } } } }
ProgressiveSleepWaitStrategy implements WaitStrategy { @Override public void snooze() { if (invocations < yieldCount) { yield(); invocations++; } else { int millis = invocations - yieldCount + initialSleepMillis; sleep(millis); if (millis < maxSleepMillis) { invocations++; } } } ProgressiveSleepWaitStrategy();  ProgressiveSleepWaitStrategy(int yieldCount, int initialSleepMillis, int maxSleepMillis); }
ProgressiveSleepWaitStrategy implements WaitStrategy { @Override public void snooze() { if (invocations < yieldCount) { yield(); invocations++; } else { int millis = invocations - yieldCount + initialSleepMillis; sleep(millis); if (millis < maxSleepMillis) { invocations++; } } } ProgressiveSleepWaitStrategy();  ProgressiveSleepWaitStrategy(int yieldCount, int initialSleepMillis, int maxSleepMillis); @Override void reset(); @Override void snooze(); }
ProgressiveSleepWaitStrategy implements WaitStrategy { @Override public void snooze() { if (invocations < yieldCount) { yield(); invocations++; } else { int millis = invocations - yieldCount + initialSleepMillis; sleep(millis); if (millis < maxSleepMillis) { invocations++; } } } ProgressiveSleepWaitStrategy();  ProgressiveSleepWaitStrategy(int yieldCount, int initialSleepMillis, int maxSleepMillis); @Override void reset(); @Override void snooze();  }