src/main/java/com/googlecode/junittoolbox/PollingWait.java
public void until(@Nonnull RunnableAssert runnableAssert) {
        List<Throwable> errors = new ArrayList<>();
        long startTime = System.currentTimeMillis();
        long timeoutReached = startTime + timeoutMillis;
        boolean success = false;
        do {
            try {
                runnableAssert.run();
                success = true;
            } catch (Throwable t) {
                if (errors.size() > 0 && startTime > timeoutReached) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(runnableAssert);
                    sb.append(" did not succeed within ");
                    appendNiceDuration(sb, timeoutMillis);
                    appendErrors(sb, errors, t);
                    throw new AssertionError(sb.toString());
                }
                if (errors.size() < 2) {
                    errors.add(t);
                }
                long sleepTime = pollIntervalMillis - (System.currentTimeMillis() - startTime);
                if (sleepTime > 0) {
                    sleep(sleepTime);
                }
                startTime = System.currentTimeMillis();
            }
        } while (!success);
    }
/**
     * Repetitively executes the given <code>runnableAssert</code>
     * until it succeeds without throwing an {@link Error} or
     * {@link Exception} or until the configured {@link #timeoutAfter timeout}
     * is reached, in which case an {@link AssertionError} will be thrown.
     * Calls {@link Thread#sleep} before each retry using the configured
     * {@link #pollEvery interval} to free the CPU for other threads/processes.
     */
Repetitively executes the given runnableAssert
until it succeeds without throwing an  Error or
Exception or until the configured  #timeoutAfter timeout
is reached, in which case an  AssertionError will be thrown.
Calls  Thread#sleep before each retry using the configured
#pollEvery interval to free the CPU for other threads/processes.
Repetitively executes the given runnableAssert until it succeeds without throwing an Error or Exception or until the configured #timeoutAfter timeout is reached in which case an AssertionError will be thrown . Calls Thread#sleep before each retry using the configured #pollEvery interval to free the CPU for other threads / processes .
public void until(@Nonnull RunnableAssert runnableAssert) {
        List<Throwable> errors = new ArrayList<>();
        long startTime = System.currentTimeMillis();
        long timeoutReached = startTime + timeoutMillis;
        boolean success = false;
        do {
            try {
                runnableAssert.run();
                success = true;
            } catch (Throwable t) {
                if (errors.size() > 0 && startTime > timeoutReached) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(runnableAssert);
                    sb.append(" did not succeed within ");
                    appendNiceDuration(sb, timeoutMillis);
                    appendErrors(sb, errors, t);
                    throw new AssertionError(sb.toString());
                }
                if (errors.size() < 2) {
                    errors.add(t);
                }
                long sleepTime = pollIntervalMillis - (System.currentTimeMillis() - startTime);
                if (sleepTime > 0) {
                    sleep(sleepTime);
                }
                startTime = System.currentTimeMillis();
            }
        } while (!success);
    }
public void until ( @ Nonnull RunnableAssert runnableAssert ) { List < Throwable > errors = new ArrayList < > ( ) ; long startTime = System . currentTimeMillis ( ) ; long timeoutReached = startTime + timeoutMillis ; boolean success = false ; do { try { runnableAssert . run ( ) ; success = true ; } catch ( Throwable t ) { if ( errors . size ( ) > 0 && startTime > timeoutReached ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( runnableAssert ) ; sb . append ( " did not succeed within " ) ; appendNiceDuration ( sb , timeoutMillis ) ; appendErrors ( sb , errors , t ) ; throw new AssertionError ( sb . toString ( ) ) ; } if ( errors . size ( ) < 2 ) { errors . add ( t ) ; } long sleepTime = pollIntervalMillis - ( System . currentTimeMillis ( ) - startTime ) ; if ( sleepTime > 0 ) { sleep ( sleepTime ) ; } startTime = System . currentTimeMillis ( ) ; } } while ( ! success ) ; }
Repetitively executes the given <code>runnableAssert</code>
 until it succeeds without throwing an {@link Error} or
 {@link Exception} or until the configured {@link #timeoutAfter timeout}
 is reached, in which case an {@link AssertionError} will be thrown.
Repetitively executes the given <code > runnableAssert< / code > until it succeeds without throwing an { @link Error } or { @link Exception } or until the configured { @link #timeoutAfter timeout } is reached in which case an { @link AssertionError } will be thrown .