I want to use ArgumentCaptor
in kotlin
.
What I've done :
val c := ArgumentCaptor<List<MyClass>,
List<MyClass>>.forClass(List<MyClass>::class.java)
but it says
Only classes are allowed on the left hand side of a class literal
I want to use ArgumentCaptor
in kotlin
.
What I've done :
val c := ArgumentCaptor<List<MyClass>,
List<MyClass>>.forClass(List<MyClass>::class.java)
but it says
Only classes are allowed on the left hand side of a class literal
ArgumentCaptor<List<MyClass>> c = ArgumentCaptor.forClass(List<MyClass>.class);
doesn't compile in Java either, because at runtime <MyClass>
isn't part of the type due to erasure.
Instead, consider using com.nhaarman:mockito-kotlin
which wraps Mockito with an API more suitable for use from Kotlin.
val c = argumentCaptor<List<MyClass>>()