So you mean basically that I should use the second parameter of verify (e.g.
verify(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) {...}
m
Mike
01/23/2020, 1:31 PM
Mockito should be verifying that
sut.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?