// Path: src/main/java/pl/domzal/junit/docker/rule/ex/WaitTimeoutException.java
// public class WaitTimeoutException extends TimeoutException {
// 
//     private final long waited;
// 
//     public WaitTimeoutException(String message, long waited) {
//         super(message);
//         this.waited = waited;
//     }
// 
//     public long getWaited() {
//         return waited;
//     }
// }
// 
// Path: src/main/java/pl/domzal/junit/docker/rule/wait/StartConditionCheck.java
// public interface StartConditionCheck {
// 
//     /**
//      * 'Is condition fulfilled?' check.
//      */
//     boolean check();
// 
//     /**
//      * Condition description (will show in log messages).
//      */
//     String describe();
// 
//     /**
//      * After check cleanup. Use if you check need to do some cleaning after usage.
//      */
//     void after();
// 
// }


import java.util.Arrays;
import pl.domzal.junit.docker.rule.ex.WaitTimeoutException;
import pl.domzal.junit.docker.rule.wait.StartConditionCheck;
package pl.domzal.junit.docker.rule;



public class WaitUtil {

    // how long to wait at max when doing a http ping
    private static final long DEFAULT_MAX_WAIT = 10 * 1000;

    // How long to wait between pings
    private static final long WAIT_RETRY_WAIT = 500;

    private WaitUtil() {}

    public static long wait(int maxWait, StartConditionCheck... checkers) throws WaitTimeoutException {
        return wait(maxWait, Arrays.asList(checkers));
    }

    public static long wait(int maxWait, Iterable<StartConditionCheck> checkers) throws WaitTimeoutException {
        long max = maxWait > 0 ? maxWait : DEFAULT_MAX_WAIT;
        long now = System.currentTimeMillis();
        try {
// Path: src/main/java/pl/domzal/junit/docker/rule/ex/WaitTimeoutException.java
// public class WaitTimeoutException extends TimeoutException {
// 
//     private final long waited;
// 
//     public WaitTimeoutException(String message, long waited) {
//         super(message);
//         this.waited = waited;
//     }
// 
//     public long getWaited() {
//         return waited;
//     }
// }
// 
// Path: src/main/java/pl/domzal/junit/docker/rule/wait/StartConditionCheck.java
// public interface StartConditionCheck {
// 
//     /**
//      * 'Is condition fulfilled?' check.
//      */
//     boolean check();
// 
//     /**
//      * Condition description (will show in log messages).
//      */
//     String describe();
// 
//     /**
//      * After check cleanup. Use if you check need to do some cleaning after usage.
//      */
//     void after();
// 
// }


// Path: src/main/java/pl/domzal/junit/docker/rule/WaitUtil.java
import java.util.Arrays;
import pl.domzal.junit.docker.rule.ex.WaitTimeoutException;
import pl.domzal.junit.docker.rule.wait.StartConditionCheck;

package pl.domzal.junit.docker.rule;



public class WaitUtil {

    // how long to wait at max when doing a http ping
    private static final long DEFAULT_MAX_WAIT = 10 * 1000;

    // How long to wait between pings
    private static final long WAIT_RETRY_WAIT = 500;

    private WaitUtil() {}

    public static long wait(int maxWait, StartConditionCheck... checkers) throws WaitTimeoutException {
        return wait(maxWait, Arrays.asList(checkers));
    }

    public static long wait(int maxWait, Iterable<StartConditionCheck> checkers) throws WaitTimeoutException {
        long max = maxWait > 0 ? maxWait : DEFAULT_MAX_WAIT;
        long now = System.currentTimeMillis();
        try {
            do {