Hey everyone. Is there a simpler way to capture (Mockito) a single parameter of a Kotlin function that has multiple parameters, of which all have a default value.
Copy code
fun foo(int: Int = 0, string: String = "")
verify(someMock).foo(int = intCaptor.capture)
Currently Mockito is throwing a
InvalidUseOfMatchersException
, claiming its expecting 5 matchers (actual number of parameters) and instead it only recorded one. Im hoping theres a better approach than creating 5 different captors.
b
Brian Saltz Jr
04/29/2020, 9:10 PM
You should be able to mix captors with matchers, e.g.
any()
or
eq(value)
. You’d still have to provide all 5 parameters, but you don’t need to provide a captor for each one. You just can’t mix captors/matchers with actual values, which is what your