I would like to capture a no-arg lambda argument a...
# mockk
d
I would like to capture a no-arg lambda argument and then invoke it. The problem is that the return type of the lambda is inferred and differs per each invocation. Is there any way how can I construct a mock for this scenario?
Copy code
fun <T> execute(operation: Operation, contract: ContractDTO, block: () -> T): T

every { execute(any(), any(), captureLambda()) } answers {
   lambda<() -> ???>().invoke()
}
How to specify the
lambda
type so that it can be used for any actual type
T
?
In other words, I'm asking whether it's possible to mock a function with a generic lambda argument.
e
Any?
?