Somewhat related but apparently mockk is broken in...
# mockk
m
Somewhat related but apparently mockk is broken in regards to recursive functions? I have this implementation:
Copy code
fun testDummyImpl(input: String): String {
    if (mRetryCounter > MAX_RETRY_COUNT) {
        return ""
    } else {
        mRetryCounter++
        return testDummyImpl(input)
    }
}

fun testDummy(input: String): String {
    return testDummyImpl(input)
}
that i test with:
Copy code
@Test
fun testDummy() {
    runBlockingTest {
        val sut = MySystemUnderTest()

        try {
            val dummyResult = sut.testDummy("Input")
        } catch (e: Exception) {
            var debug = 42
            debug++
        }

        verify(exactly = 3) {
            sut.testDummyImpl(any())
        }
    }
}
The test fails with
One matching call found, but needs at least 3 and at most 3 calls
even though its clearly called 3 times (double-checked with a debugger). What gives?