Hi, how do you deal with `Mockito.any(T::class.jav...
# android
w
Hi, how do you deal with
Mockito.any(T::class.java)
return null in Kotlin?
g
Yes, Mockito.any returns null, not only in Kotlin, but in case of Kotlin is bigger issue. Mockito-kotlin solved this, you can use this library, or check their workaround:
m
Copy code
fun <T> uninitialized(): T = null as T

fun <T> any(): T {
    Mockito.any<T>()
    return uninitialized()
}
👍🏼 1
w
Thanks guys
a
mockito-kotlin - will help you
m
Supplying
null
also works for me