waitForIviServiceCoFunResult

fun <R, F : KFunction<R>> waitForIviServiceCoFunResult(    function: F,     timeoutMs: Long,     block: suspend (F) -> R): R

Utility function to wait for an IVI service coroutine function result.

Invokes block with the function as argument and waits for it to return until timeoutMs is reached.

On a timeout, an AssertionError is thrown. The assertion message contains the function signature. When block throws an exception the exception is rethrown.

Returns the value returned by the block.

In most cases, use waitForAndCheckIviServiceCoFunResult instead, which extends this function with error checking. This function may be used to handle exceptions differently.

Prefer this function over waitForIviServiceAsyncFunResult as this function is able to add the function signature to the thrown AssertionError exceptions.

Example usage:

val tripService = createApiWrapper { TripService.createApi(...) }
assertFailsWith<IllegalArgumentException> {
waitForIviServiceCoFunResult(TripServiceApi::coPlanTripTo) {
it(tripService, EINDHOVEN_PLACE)
}
}