mockito / mockito-kotlin

Using Mockito with Kotlin
MIT License
3.1k stars 200 forks source link

Matchers.kt uses `Mockito.any` instead of `ArgumentMatchers.any` #386

Closed TimvdLippe closed 3 years ago

TimvdLippe commented 3 years ago

For example https://github.com/nhaarman/mockito-kotlin/blob/dbdef2fd74b86868a953e1ba609d235664148f50/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/Matchers.kt#L44 uses Mockito.any rather than ArgumentMatchers.any. Since Mockito currently inherits from Matchers and that in turn inherits from ArgumentMatchers, this works. However, that inheritance is causing issues for users that use Mockito 1 and need to upgrade to Mockito 2.

Can we use ArgumentMatchers instead for all methods that are defined on that class, to make sure that all matchers are non-null (org.mockito.Matchers.any(Class) accepts null in Mockito 1). This should be a non-breaking change for Mockito 2.

Note that in the future we are likely going to remove the inheritance chain from Mockito to ArgumentMatchers and so mockito-kotlin would break.