createApiWrapper

abstract fun <R> createApiWrapper(iviInstanceId: IviInstanceId = IviFunctionalTestCase.defaultIviInstanceId, callback: CreateApiCallback<R>): R

Wrapper around <Service>.createApi() calls.

This wrapper ensures the API class instance is created on the main thread.

Example:

val serviceApi = createApiWrapper { lifecycleOwner, iviServiceProvider ->
ExampleService.createApi(lifecycleOwner, iviServiceProvider)
}

Parameters

iviInstanceId

The IVI instance ID to use.

callback

Called on the main thread which allows the caller to create an API class instance. The callback is provided with two arguments: The lifecycle owner which is bound to the lifecycle of the test and the IviServiceProvider instance.