mockkService

@JvmName(name = "mockkServiceKFunction3")
inline fun <T : AnyIviServiceApiBase> mockkService(    createApi: (LifecycleOwner, IviServiceProvider, Any) -> T,     queuedActions: MutableList<() -> Unit> = mutableListOf(),     mockServiceImplementation: T.() -> Unit = {}): T

Mocks the IVI service returned by createApi. This is for services that are always expected to be registered. For services that are optionally registered, use mockkOptionalService instead.

Return

A reference to the created service mock. The caller does not need to keep a reference in order to prevent the mock from being garbage collected.

Parameters

T

The type of the service API.

createApi

A function reference to the createApi call used by production code to get a reference to the service API.

queuedActions

If IviServiceApiBase.queueOrRunAction is called while the service is not available (IviServiceApiBase.serviceAvailable is false), the lambda given to IviServiceApiBase.queueOrRunAction is added to this list.

mockServiceImplementation

The MockK block for the service mock, containing things like every statements.


@JvmName(name = "mockkServiceKFunction2")
inline fun <T : AnyIviServiceApiBase> mockkService(    createApi: (LifecycleOwner, IviServiceProvider) -> T,     queuedActions: MutableList<() -> Unit> = mutableListOf(),     mockServiceImplementation: T.() -> Unit = {}): T

Mocks the IVI service returned by createApi. This is for services that are always expected to be registered. For services that are optionally registered, use mockkOptionalService instead.

Return

A reference to the created service mock. The caller does not need to keep a reference in order to prevent the mock from being garbage collected.

Parameters

T

The type of the service API.

createApi

T function reference to the createApi call used by production code to get a reference to the service API.

queuedActions

If IviServiceApiBase.queueOrRunAction is called while the service is not available (IviServiceApiBase.serviceAvailable is false), the lambda given to IviServiceApiBase.queueOrRunAction is added to this list.

mockServiceImplementation

The MockK block for the service mock, containing things like every statements.


@JvmName(name = "mockkServiceKFunction2")
inline fun <T : AnyIviServiceApiBase> mockkService(    createApis: (LifecycleOwner, IviServiceProvider) -> List<T>,     queuedActions: MutableList<() -> Unit> = mutableListOf(),     vararg mockServices: T): List<T>

Mocks the IVI services returned by createApis. This is for discoverable services that may have multiple registered services.

Return

A reference to mockServices for convenience. The caller does not need to keep a reference in order to prevent the mock from being garbage collected.

Parameters

T

The type of the service API.

createApis

A function reference to the createApis call used by production code to get references to the service APIs.

queuedActions

If IviServiceApiBase.queueOrRunAction is called while the service is not available (IviServiceApiBase.serviceAvailable is false), the lambda given to IviServiceApiBase.queueOrRunAction is added to this list.

mockServices

The MockK service mock.