title: Mockito ArgumentMatcher saying Arguments are Different
body: <p>I am using Mockito for Unit testing and I am using ArgumentMatcher to check if a particular field of an argument has a particular value.</p>
  
  <p>I have a StatusMatcher class that extends ArgumentMatcher and checks whether an object of class MyClass has a particular value in status field. The way I am invoking this in the tests is: </p>
  
  <pre><code>verify(myDAO, times(1)).update(argThat(new StatusMatcher("SomeStatus")));
  </code></pre>
  
  <p>Here <code>update</code> is the method of the DAO that is getting called with some MyClass object. I want to see if it has the correct status or not. This is what I get: </p>
  
  <pre><code>Argument(s) are different! Wanted:
  myDAO.update(
      &lt;Status matcher&gt;
  );
  -&gt; at com.foo.bar.MyTest.test1 
  Actual invocation has different arguments:
  myDAO.update(
      com.foo.bar.MyClass
  );
  </code></pre>
  
  <p>Note that this is working perfectly for all the test cases except one test case. So I know the StatusMatcher etc. have been coded correctly. I am not sure what is different about the method where its getting this exception.</p>
  
  <p>What I want to know is: under what conditions will the ArgumentMatcher throw such exception so I can find out what I am missing (It is not for me to paste the actual method codes)
  Please tell me if the explanation is not clear enough, and I will try to improve it. Thanks for reading this far :)</p>
  
  <p>EDIT: Here is the code for my StatusMatcher class</p>
  
  <pre><code>    private class StatusMatcher extends ArgumentMatcher&lt;MyClass&gt; {
  
      private String status;
      public StatusMatcher(String hs) { 
          status = hs;
      }
  
      @Override
      public boolean matches(Object argument) {
  
          return status.equals(((MyClass)argument).getStatus());
      } 
  }
  </code></pre>