Hi,
If I have code that looks like this, with junit 4.12, Kotlin 1.2.0, and the 0.21 coroutine packages:
interface Interface {
suspend fun foo(): String
}
class Caller(private val instance: Interface) {
fun execute() {
runBlocking {
instance.foo()
}
}
}
@Test
fun test() {
runBlocking {
val mock = createMock(Interface::class.java)
expect(mock.foo()).andReturn("bar")
replayAll()
Caller(mock).execute()
}
}
Then the test fails with
java.lang.AssertionError:
Unexpected method call Interface.foo(kotlinx.coroutines.experimental.CoroutineScope.() -> kotlin.String):
Interface.foo(kotlinx.coroutines.experimental.CoroutineScope.() -> kotlin.Unit): expected: 1, actual: 0
This is preventing me from actually unit testing my classes and interfaces, which is pretty frustrating. Suggestions?