I have a Kotlin class (The problem was simplified to have a basic example), in it there is a method testedMethod()
I want to test interactions on.
I want to make sure the correct parameter is passed to anotherMethod()
, my problem is that the parameter is not a value but a lambda function.
A simple solution in Kotlin is what I am looking for, it may or may not be based on this solution for java.
class TestedClass {
fun testedMethod() {
anotherMethod({ passedMethod() })
}
fun passedMethod() {}
fun anotherMethod(lambdaParameter: () -> Unit) {
// Does something with lambdaParameter
}
}