Package io.skodjob.testframe.wait
Class Wait
java.lang.Object
io.skodjob.testframe.wait.Wait
Wait utils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiduntil(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true.static voiduntil(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready, Runnable onTimeout) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true.static CompletableFuture<Void>untilAsync(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true.
-
Method Details
-
until
public static void until(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true. If yes, the wait is closed. Otherwise, waits anotherpollIntervalMsand tries again. Once the wait timeout (specified bytimeoutMsis reached and supplier wasn't true until that time, throwsWaitException.- Parameters:
description- information about on what we are waitingpollIntervalMs- poll interval in millisecondstimeoutMs- timeout specified in millisecondsready-BooleanSuppliercontaining code, which should be executed each poll, verifying readiness of the particular thing
-
until
public static void until(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready, Runnable onTimeout) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true. If yes, the wait is closed. Otherwise, waits anotherpollIntervalMsand tries again. Once the wait timeout (specified bytimeoutMsis reached and supplier wasn't true until that time, runs theonTimeout(f.e. print of logs, showing the actual value that was checked insideready), and finally throwsWaitException.- Parameters:
description- information about on what we are waitingpollIntervalMs- poll interval in millisecondstimeoutMs- timeout specified in millisecondsready-BooleanSuppliercontaining code, which should be executed each poll, verifying readiness of the particular thingonTimeout-Runnableexecuted once timeout is reached and before theWaitExceptionis thrown.
-
untilAsync
public static CompletableFuture<Void> untilAsync(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) For every poll (happening once eachpollIntervalMs) checks if supplierreadyis true. If yes, the wait is closed. Otherwise, waits anotherpollIntervalMsand tries again. Once the wait timeout (specified bytimeoutMsis reached and supplier wasn't true until that time, runs theonTimeout(f.e. print of logs, showing the actual value that was checked insideready), and finally throwsWaitException.- Parameters:
description- information about on what we are waitingpollIntervalMs- poll interval in millisecondstimeoutMs- timeout specified in millisecondsready-BooleanSuppliercontaining code, which should be executed each poll, verifying readiness of the particular thing- Returns:
- completable future for waiting
-