iviServiceFunResult

fun <T, B, V> MockKAnswerScope<T, B>.iviServiceFunResult(value: V)

Short hand to answer an IVI service function with a successful result code and return value.

Example usages:

private val mockServiceApi = niceMockk<ExampleServiceApi> {
every { doSomethingWithReturnValueAsync(any()) } answers { iviServiceFunResult(42) }
}

Parameters

V

The return value type. Can be Unit.

value

The return value.


fun <T, B, V> MockKAnswerScope<T, B>.iviServiceFunResult(resultType: IviServiceFunResult.ResultType, exception: Exception? = null)

Short hand to answer an IVI service function with a failure result code and optional exception.

Example usages:

private val mockServiceApi = niceMockk<ExampleServiceApi> {
every { doSomethingWithReturnValueAsync(any()) } answers {
iviServiceFunResult(IviServiceFunResult.ResultType.SERVICE_UNAVAILABLE)
}
}

Parameters

V

The return value type. Can be Unit.

resultType

Mocks a result type. See IviServiceFunResult.ResultType for possible values.

exception

Mocks an exception thrown by the function.