waitForAndCheckIviServiceAsyncFunResult
Utility function to wait for an IVI service async function result and check the result.
Invokes function with an onResult
argument and waits for the onResult
callback to be invoked by the function until timeoutMs is reached. Afterwards, the IviServiceFunResult given to the onResult
callback is checked against the expectedResultType. An AssertionError is thrown when the result type does not match or when the timeout is reached.
Returns the IviServiceFunResult given to the onResult
callback.
Prefer the use of waitForAndCheckIviServiceCoFunResult over this function. As waitForAndCheckIviServiceCoFunResult is able to add the function name to the thrown AssertionError exception, whereas this function is not able to add any meaningful information.
Example usage:
val tripService = createApiWrapper { TripService.createApi(...) }
waitForAndCheckIviServiceAsyncFunResult<Unit> { onResult ->
tripService.planTripToAsync(EINDHOVEN_PLACE, onResult)
}