While trying to mock up a function call getInventoryList(object, string, int, object, int) I found that I would continually encounter the error ArgumentMatchers.any() must not be null.
Here are some solutions I tried. The MockitoHelper
object MockitoHelper {
fun <T> anyObject(): T {
Mockito.any<T>()
return uninitialized()
}
@Suppress("UNCHECKED_CAST")
fun <T> uninitialized(): T = null as T
}
The any object deprecated function
ArgumentMatchers.anyObject()
The any(class : T)
ArgumentMatchers.any(Object::class.java)
None of the above worked for this particular problem. Each of them came back with a similar must not be null error