code: public void waitUntilNoMoreException(final Runnable runnable, final List<Class<? extends Exception>> expectedExceptions) {
  
          final List<RuntimeException> actualExceptions = new ArrayList<>();
          int tries = 0;
          while (tries < maxTries) {
              try {
                  runnable.run();
                  return;
              } catch (final RuntimeException ex) {
                  if (!Utils4J.expectedException(ex, expectedExceptions) && !Utils4J.expectedCause(ex, expectedExceptions)) {
                      throw ex;
                  }
                  actualExceptions.add(ex);
                  tries++;
                  Utils4J.sleep(sleepMillis);
              }
          }
          throw new IllegalStateException("Waited too long for execution without exception. Expected exceptions: " + expectedExceptions
                  + ", Actual exceptions: " + actualExceptions);
  
      }
docs: Wait until no more expected exception is thrown or the number of wait cycles has been exceeded.
  
  @param runnable
  Code to run.
  @param expectedExceptions
  List of expected exceptions.