Andrey Tarasevich
01/27/2019, 5:20 PMinvoke
function and then you can something like
typealias MockResponse = HttpClientCall.() -> MockHttpResponse
fun mockEngine(responses: Array<out MockResponse>): MockEngineCounting {
return MockEngineCounting.invoke { invocationCount ->
if (invocationCount == responses.size) {
error("Unhandled ${url.fullUrl} on invocationCount=$invocationCount")
} else {
responses[invocationCount](call)
}
}
}
Is it like the right way to go or there is some better solution?