Sarah Gross
12/09/2020, 3:23 PM_whenever_(myMethod(
_any_(), _any_(),_any_(), _any_(), _any_(), _any_(), _any_(), _any_())
).thenReturn
Joel
12/09/2020, 4:01 PMclass BuilderDsl {
var foo: Int
var bar: Int
}
fun doSomething(config: BuilderDsl.() -> Unit): Int {
return BuilderDsl().apply(config).let { it.foo + it.bar }
}
Then you only have to mock the config lambda.Joel
12/09/2020, 4:01 PMSarah Gross
12/09/2020, 4:03 PMSarah Gross
12/09/2020, 4:27 PMTobias Berger
12/09/2020, 5:12 PMJoel
12/09/2020, 5:33 PMJoel
12/09/2020, 5:34 PMmockk
to be easier to use than mockito
when it comes to Kotlin code. There may be something of value in there.Sarah Gross
12/09/2020, 5:34 PM