iviServiceFunResult
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) }
}
Content copied to clipboard
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)
Content copied to clipboard
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)
}
}
Content copied to clipboard
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.