Patrick Ramsey
04/13/2021, 5:26 AMverify {
someMethod(capture(mySlot), "Some specific value")
}
Is there any way to actually just capture the value from when someMethod() was called with “Some specific value”? Or will that capture() match every single call, even the ones where the whole expression doesn’t match?ephemient
04/13/2021, 5:46 AMPatrick Ramsey
04/13/2021, 5:46 AMephemient
04/13/2021, 5:47 AMval slot = mutableListOf<T>()
val obj = mockk {
justRun { someMethod(any(), any()) }
justRun { someMethod(capture(slot), eq("Some specific value")) }
}
obj.someMethod("foo", "bar")
obj.someMethod("capture me", "Some specific value")
Patrick Ramsey
04/13/2021, 5:47 AMephemient
04/13/2021, 5:49 AMPatrick Ramsey
04/13/2021, 5:49 AMephemient
04/13/2021, 5:50 AMPatrick Ramsey
04/13/2021, 5:50 AMephemient
04/13/2021, 5:50 AMPatrick Ramsey
04/13/2021, 5:50 AMephemient
04/13/2021, 5:50 AMPatrick Ramsey
04/13/2021, 5:50 AMephemient
04/13/2021, 5:51 AMPatrick Ramsey
04/13/2021, 5:51 AMephemient
04/13/2021, 5:52 AMPatrick Ramsey
04/13/2021, 5:52 AMephemient
04/13/2021, 5:53 AMPatrick Ramsey
04/13/2021, 5:53 AMephemient
04/13/2021, 5:54 AMPatrick Ramsey
04/13/2021, 5:55 AMMattia Tommasone
04/13/2021, 7:21 AMcapture
should be capturing only calls that are actually matched by a verify block and not all calls.
It is indeed a bug; i may try taking a shot at fixing it soon, but if in the meantime you want to start looking into it i’d be more than glad, feel free to shoot any questions 🙂