From 1826d3aa72360fbd219c5287e306f59131007c01 Mon Sep 17 00:00:00 2001 From: Daniele Pantaleone Date: Sat, 18 Nov 2023 09:38:02 +0100 Subject: [PATCH] Provide extra public interface to wait for expectations using vararg --- .../kttestexpectation/KTTestExpectation.kt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/kttestexpectation/src/main/java/io/github/danielepantaleone/kttestexpectation/KTTestExpectation.kt b/kttestexpectation/src/main/java/io/github/danielepantaleone/kttestexpectation/KTTestExpectation.kt index 0cabaae..ba69bf9 100644 --- a/kttestexpectation/src/main/java/io/github/danielepantaleone/kttestexpectation/KTTestExpectation.kt +++ b/kttestexpectation/src/main/java/io/github/danielepantaleone/kttestexpectation/KTTestExpectation.kt @@ -222,7 +222,22 @@ fun waitForExpectation(expectation: KTTestExpectation, time: Long, unit: TimeUni } /** - * Waits on a group of expectations for up to the specified timeout + * Waits on a group of expectations for up to the specified timeout. + * + * @param expectations An array of expectations that must be fulfilled + * @param time The maximum time to wait for expectations to be fulfilled + * @param unit The time unit of the time argument + * @throws KTTestException If any of the expectations was already fulfilled + * @throws KTTestException If no expectation was provided + * @throws KTTestException If any of the provided expectations cannot be fulfilled within the specified timeout + */ +@Throws(KTTestException::class) +fun waitForExpectations(vararg expectations: KTTestExpectation, time: Long, unit: TimeUnit) { + waitForExpectations(expectations = expectations.toList(), time = time, unit = unit) +} + +/** + * Waits on a group of expectations for up to the specified timeout. * * @param expectations An array of expectations that must be fulfilled * @param time The maximum time to wait for expectations to be fulfilled