Mikolaj
flow
dropWhile
@Test fun `test mock flow`() = runTest { val flow: Flow<Int> = mockk(relaxed = true) { coEvery { dropWhile(any()) } returns this } }
Failed matching mocking signature for left matchers: [any()]
Jakub Gwóźdź
every {…
coEvery
@Test fun `test mock flow`(): Unit = runBlocking { val flow: Flow<Int> = flowOf(1, 2, 1, 3, 1, 4) mockkStatic(Flow<Int>::dropWhile) every { flow.dropWhile(any()) } answers { println("mock hit!"); flow } flow.dropWhile { it < 3 }.collect { println(it) } }
KFunction
mockkStatic("kotlinx.coroutines.flow.FlowKt")
A modern programming language that makes developers happier.