Hi,
We recently ran into UnfinishedVerificationException which was rather tricky to track down. The problem stems from an incorrect usage of the API, namely Mockito.verify which clearly states that `someMethod` is expected to be invoked on the returned mock.
In our case, it was a closure object (in scala) which was being mocked, resulting in the following specification (using MockitoSugar with scalatest),
verify(resourceProvider, times(3))
Since resourceProvider is typically invoked via (), the user forgot to specify 'apply', i.e.,
verify(resourceProvider, times(3)).apply()
The end result was an unvalidated MockingProgressImpl? because we saw the exception being thrown here [1], except it was an unrelated unit test which triggered it.
Is there a better way to guard against this type of incorrect API usage?
Thanks.
Best,
stan