@@ -17,6 +17,7 @@ import java.time.Duration
1717import java.util.concurrent.ExecutorService
1818import java.util.concurrent.atomic.AtomicBoolean
1919import kotlin.reflect.KClass
20+ import kotlin.time.toJavaDuration
2021
2122/* *
2223 * This is typically the starting point of the Kotlin "DSL". Allows you to write `await` instead of `await()`. For example:
@@ -164,6 +165,15 @@ infix fun ConditionFactory.untilAsserted(fn: () -> Unit): Unit = untilAsserted(f
164165 */
165166infix fun ConditionFactory.atMost (duration : Duration ): ConditionFactory = atMost(duration)
166167
168+ /* *
169+ * Await at most `timeout` before throwing a timeout exception.
170+ *
171+ * @param duration the duration
172+ * @return the condition factory
173+ * @since 4.2.3
174+ */
175+ infix fun ConditionFactory.atMost (duration : kotlin.time.Duration ): ConditionFactory = atMost(duration.toJavaDuration())
176+
167177/* *
168178 * Condition has to be evaluated not earlier than `timeout` before throwing a timeout exception.
169179 *
@@ -173,6 +183,15 @@ infix fun ConditionFactory.atMost(duration: Duration): ConditionFactory = atMost
173183 */
174184infix fun ConditionFactory.atLeast (timeout : Duration ): ConditionFactory = atLeast(timeout)
175185
186+ /* *
187+ * Condition has to be evaluated not earlier than `timeout` before throwing a timeout exception.
188+ *
189+ * @param timeout the timeout
190+ * @return the condition factory
191+ * @since 4.2.3
192+ */
193+ infix fun ConditionFactory.atLeast (timeout : kotlin.time.Duration ): ConditionFactory = atLeast(timeout.toJavaDuration())
194+
176195/* *
177196 * Await forever until the condition is satisfied. Caution: You can block
178197 * subsequent tests and the entire build can hang indefinitely, it's
@@ -249,6 +268,17 @@ infix fun ConditionFactory.withAlias(alias: String): ConditionFactory = alias(al
249268 */
250269infix fun ConditionFactory.withPollDelay (pollDelay : Duration ): ConditionFactory = pollDelay(pollDelay)
251270
271+ /* *
272+ * Specify the delay that will be used before Awaitility starts polling for
273+ * the result the first time. If you don't specify a poll delay explicitly
274+ * it'll be the same as the poll interval.
275+ *
276+ * @param pollDelay the poll delay
277+ * @return the condition factory
278+ * @since 4.2.3
279+ */
280+ infix fun ConditionFactory.withPollDelay (pollDelay : kotlin.time.Duration ): ConditionFactory = withPollDelay(pollDelay.toJavaDuration())
281+
252282/* *
253283 * Specify the polling interval Awaitility will use for this await
254284 * statement. This means the frequency in which the condition is checked for
@@ -261,6 +291,18 @@ infix fun ConditionFactory.withPollDelay(pollDelay: Duration): ConditionFactory
261291 */
262292infix fun ConditionFactory.withPollInterval (pollInterval : Duration ): ConditionFactory = pollInterval(pollInterval)
263293
294+ /* *
295+ * Specify the polling interval Awaitility will use for this await
296+ * statement. This means the frequency in which the condition is checked for
297+ * completion.
298+ *
299+ * @param pollInterval the poll interval
300+ * @return the condition factory
301+ * @since 4.2.3
302+ * @see [ConditionFactory.pollInterval]
303+ */
304+ infix fun ConditionFactory.withPollInterval (pollInterval : kotlin.time.Duration ): ConditionFactory = withPollInterval(pollInterval.toJavaDuration())
305+
264306/* *
265307 * Specify the polling interval Awaitility will use for this await
266308 * statement. For example [org.awaitility.pollinterval.FibonacciPollInterval.fibonacci].
@@ -371,4 +413,22 @@ infix fun <T> ConditionFactory.conditionEvaluationListener(conditionEvaluationLi
371413 * @return the condition factory
372414 * @since 4.2.1
373415 */
374- infix fun ConditionFactory.logging (logPrinter : (String ) -> Unit ) = logging(logPrinter)
416+ infix fun ConditionFactory.logging (logPrinter : (String ) -> Unit ) = logging(logPrinter)
417+
418+ /* *
419+ * Await at the predicate holds during at least <code>timeout</code>
420+ *
421+ * @param timeout the timeout
422+ * @return the condition factory
423+ * @since 4.2.3
424+ */
425+ infix fun ConditionFactory.during (duration : Duration ): ConditionFactory = during(duration)
426+
427+ /* *
428+ * Await at the predicate holds during at least <code>timeout</code>
429+ *
430+ * @param timeout the timeout
431+ * @return the condition factory
432+ * @since 4.2.3
433+ */
434+ infix fun ConditionFactory.during (duration : kotlin.time.Duration ): ConditionFactory = during(duration.toJavaDuration())
0 commit comments