mockito / mockito-kotlin

Using Mockito with Kotlin
MIT License
3.11k stars 202 forks source link

any() method is not compatible with mockito one #465

Closed konrad-poczatek closed 1 year ago

konrad-poczatek commented 1 year ago

Hi!

In mockito any() method: Matches <strong>anything</strong>, including nulls and varargs. In mockito-kotlin any() method: Matches any object, excluding nulls.

Is it done on purpose?

FyiurAmron commented 1 year ago

@konrad-poczatek yes, it's by design:

https://github.com/mockito/mockito-kotlin/wiki

Mockito returns null values for calls to method like any(), which can cause IllegalStateException when passing them to non-nullable parameters. This library solves that issue by trying to create actual instances to return.

konrad-poczatek commented 1 year ago

@FyiurAmron thank you very much. There is just few words in Wiki and I didn't read them. Shame on me.