Here is the pseudocode of my unit test:
int invocationCount
given(mock).willDo {
invocationCount++
return value
}
doSomeProcessing()
verify(mock)
doSomeMoreProcessing()
verifyCount(mock, 2)
At this point, invocationCount == 2
, as expected. However, verifyCount
fails, saying it was only called once. In addition, if I exclude the first verify
call, the test passes as expected. It might be relevant to note that each verify
call is capturing a new argument for assertion later.
My question is this: when the first verify()
is called, is the mock's invocation count reset? If this is not the case, what could be happening?