Mikhail
07/15/2022, 7:37 PMcapture(...)
as a parameter for extension functions?
e.g.
val slot = slot<String>()
capture(slot).snakeCase()
kotlin.UninitializedPropertyAccessException: lateinit property captured has not been initialized
at io.mockk.CapturingSlot.getCaptured(API.kt:2503)
As I see, the receiver wasn't captured. Any ideas?Klitos Kyriacou
07/17/2022, 4:15 PMval slot = slot<String>()
every { capture(slot).snakeCase() } returns "a_b_c"
val res = "xyz".snakeCase()
println(slot.captured)
Have you initialised with mockkStatic
first?Mikhail
07/17/2022, 4:18 PMmockkStatic
val slot = slot<String>()
every {
capture(slot).snakeCase()
} returns slot.captured // <- fails here
val slot = slot<String>()
every {
capture(slot).snakeCase()
} answers {
slot.captured
}
let me tryKlitos Kyriacou
07/17/2022, 4:38 PMevery { any().snakeCase() } answers { firstArg() }
Mikhail
07/17/2022, 4:45 PMany<String>()
instead.