Mockito - 0 Matchers Expected, 1 Recorded (InvalidUseOfMatchersException)

I think your results are compatible with the result that would happen if dbCollection is not a Mockito-mock (or your method is static or final). That would mean that a matcher is being used where none can be used; hence the "0 matchers expected, 1 recorded".


This same issue can be reproduced in Scala if you have default arguments. It may look like you're providing any() for every argument, but you should verify that the method definition doesn't have any default parameters which might be messing things up.