@Test public void testpollValidatePollCompletionTime() { class MyCond implements BooleanSupplier { private final int _timeWaitMs; private final long _timeThen; public MyCond(int timeWaitMs) { _timeWaitMs = timeWaitMs; _timeThen = System.currentTimeMillis(); } @Override public boolean getAsBoolean() { return System.currentTimeMillis() - _timeThen >= _timeWaitMs; } } long now1 = System.currentTimeMillis(); MyCond mycond = new MyCond(400); Assert.assertTrue(PollUtils.poll(mycond, 100, 500)); long now2 = System.currentTimeMillis(); Assert.assertTrue(now2 - now1 >= 300); }
public static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs) { return poll((n) -> cond.getAsBoolean(), periodMs, timeoutMs, null); }
PollUtils { public static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs) { return poll((n) -> cond.getAsBoolean(), periodMs, timeoutMs, null); } }
PollUtils { public static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs) { return poll((n) -> cond.getAsBoolean(), periodMs, timeoutMs, null); }  }
PollUtils { public static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs) { return poll((n) -> cond.getAsBoolean(), periodMs, timeoutMs, null); }  static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs); static boolean poll(InterruptablePredicate<T> cond, long periodMs, long timeoutMs, T arg); static Optional<T> poll(InterruptableSupplier<T> interruptableSupplier, InterruptablePredicate<T> cond,
      long periodMs, long timeoutMs); }
PollUtils { public static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs) { return poll((n) -> cond.getAsBoolean(), periodMs, timeoutMs, null); }  static boolean poll(BooleanSupplier cond, long periodMs, long timeoutMs); static boolean poll(InterruptablePredicate<T> cond, long periodMs, long timeoutMs, T arg); static Optional<T> poll(InterruptableSupplier<T> interruptableSupplier, InterruptablePredicate<T> cond,
      long periodMs, long timeoutMs);  }