title: Mockito - 0 Matchers Expected, 1 Recorded (InvalidUseOfMatchersException)
body: <p>I'm trying to mock up some mongo classes so that I don't need a connection (fairly standard stuff) but the following code gives me problems:</p>
  
  <pre><code>when(dbCollection.find(isA(DBObject.class))).thenReturn(dbCursor);
  </code></pre>
  
  <p>Running this get's me:</p>
  
  <blockquote>
    <p>org.mockito.exceptions.misusing.InvalidUseOfMatchersException:<br>
    Invalid use of argument matchers!<br>
    0 matchers expected, 1 recorded:<br>
    at ...GridFileManagerTest.beforeClass(GridFileManagerTest.java:67)  </p>
    
    <p>This exception may occur if matchers are combined with raw values:<br>
    //incorrect: someMethod(anyObject(), "raw String");</p>
    
    <p>When using matchers, all arguments have to be provided by matchers.<br>
    For example:<br>
        //correct:<br>
        someMethod(anyObject(), eq("String by matcher"));</p>
    
    <p>For more info see javadoc for Matchers class.</p>
  </blockquote>
  
  <p>If I were to do this though:</p>
  
  <pre><code>when(dbCollection.find(mock(DBObject.class))).thenReturn(dbCursor);
  </code></pre>
  
  <p>it no longer has that problem. This doesn't seem to accomplish what I want though - I want to return the value when the method is called with an object of type DBObject.</p>
  
  <p>Thoughts?</p>