val taskExecutor: AsyncTaskExecutor =
mockk {
every { submit(captureLambda()) } answers {
CompletableFuture.completedFuture(lambda<() -> Int>().invoke())
}
}
but getting
Copy code
Caused by: java.lang.ClassCastException: class java.lang.Object cannot be cast to class kotlin.Function (java.lang.Object is in module java.base of loader 'bootstrap'; kotlin.Function is in unnamed module of loader 'app')
I should probably use
hint
but not sure how exactly.
David Kubecka
02/02/2023, 2:07 PM
@Mattia Tommasone Do you have any idea how lambda arguments should be captured invoked? Sorry for direct mention 🙂
David Kubecka
02/02/2023, 3:09 PM
I see the problem now.
captureLambda()
is intended only for Kotlin lambdas (which implement the