mockito-kotlin icon indicating copy to clipboard operation
mockito-kotlin copied to clipboard

Deprecate or replace nullableArgumentCaptor

Open StefMa opened this issue 4 years ago • 0 comments
trafficstars

I just realized that I can't use argumentCaptor<Type?>. I have to use the nullableArgumentCaptor for that.

After looking into the implementation I really don't get why there is an explicite argumentCaptor for nullable types.

I think most Kotlin developers would simply use argumentCaptor<Type?> and would expect that it works.

I would suggest that mockito-kotlin simply removes the nullableArgumentCatpor and return a nullable-type in the current argumentCatptor function. What do you think?

https://github.com/mockito/mockito-kotlin/blob/b8f480fd5594d037a085da2d857bdd5597a56bdf/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/ArgumentCaptor.kt#L35-L37

https://github.com/mockito/mockito-kotlin/blob/b8f480fd5594d037a085da2d857bdd5597a56bdf/mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/ArgumentCaptor.kt#L142-L144

StefMa avatar Jan 21 '21 12:01 StefMa