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?
I just realized that I can't use
argumentCaptor<Type?>
. I have to use thenullableArgumentCaptor
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 thenullableArgumentCatpor
and return a nullable-type in the currentargumentCatptor
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