kotest-assertions / io.kotest.assertions.until / until

until

suspend fun until(duration: Duration, interval: Interval = 1.seconds.fixed(), f: () -> Boolean): Boolean

Executes a function until it returns true or the duration elapses.

Parameters

f - the function to execute

duration - the maximum amount of time to continue trying for success

interval - the delay between invocations

suspend fun <T> until(duration: Duration, predicate: (T) -> Boolean, f: () -> T): T
suspend fun <T> until(duration: Duration, interval: Interval, predicate: (T) -> Boolean, f: () -> T): T suspend fun <T> until(duration: Duration, interval: Interval, predicate: (T) -> Boolean, listener: UntilListener<T>, f: () -> T): T

Executes a function until the given predicate returns true or the duration elapses.

Parameters

f - the function to execute

predicate - passed the result of the function f to evaluate if successful

listener - notified on each invocation of f

duration - the maximum amount of time to continue trying for success

interval - the delay between invocations