withIviServiceMockOnTestThread

fun <T : AnyIviServiceBase, R> withIviServiceMockOnTestThread(iviServiceMockClass: KClass<T>, block: T.() -> R): R

Applies block on the iviServiceMockClass instance on the test thread.

Must be called after configuring the mock in the initialIviServiceTestConfiguration or after configuring it by setting iviServiceTestConfiguration. The mock can be used until the configuration is changed by setting iviServiceTestConfiguration.

Example usage:

withIviServiceMockOnTestThread(ExampleServiceMock::class) {
coVerify(exactly = 1) { functions.doSomethingWithReturnValue() }
}

fun <T : AnyIviServiceBase, R> withIviServiceMockOnTestThread(iviServiceMockIdentifier: IviServiceMockIdentifier<T>, block: T.() -> R): R

Applies block on a mock instance identified by the iviServiceMockIdentifier on the test thread.

Must be called after configuring the mock in the initialIviServiceTestConfiguration or after configuring it by setting iviServiceTestConfiguration. The mock can be used until the configuration is changed by setting iviServiceTestConfiguration.

Example usage:

val mockIdentifier = IviServiceMockIdentifier(
IviServiceId("com.tomtom.ivi.service.example"),
ExampleDiscoverableServiceMock::class
)
withIviServiceMockOnMainThread(mockIdentifier) {
coVerify(exactly = 1) { functions.doSomethingWithReturnValue() }
}

In the above example the given block is applied on the ExampleDiscoverableServiceMock class instance with IVI service ID com.tomtom.ivi.service.example.