René
01/22/2020, 7:04 PMverify(sut).someMethod("example")
, but that throws always 3 invocations (two other where on other methods). I have right now no idea how to fix that testBarco
01/23/2020, 2:00 AMVerificationMode
to your verify()
function call to do your own assertions on the method interactionBarco
01/23/2020, 2:05 AMtimes()
to assert number of times the method is calledBarco
01/23/2020, 2:05 AMRené
01/23/2020, 7:13 AMverify(sut, times(3)).someMethod("example")
)? If so that does not work for me. I could only set it to 3 because in total 3 methods are called on that mocked class, but I could not verify which method which makes it worthless. Especially want to verify the passed parameters, that seems not to work at all. The method definition looks like that: fun somMethod(label: String, flag: Boolean = false) {...}
Mike
01/23/2020, 1:31 PMsut.someMethod("eample")
was called only once (the default for times
) using your initial definition.
I don't know what, but something isn't defined/configured correctly. Can you point us to more code?
And we're all assuming you're using Mockito. Let us know if it's Mockk or something else.
And you're 100% sure your method isn't being called 3 times somehow?Barco
01/24/2020, 1:25 AMArgumentCaptor
instead of the actual parameters to someMethod()
to verify what they are in your test.