title: Mockito acts strangely when I assign multiple custom matchers to a single method
body: <p>I'm wanting to use two custom matchers for a single method.  Basically, if I pass the method VALUE_A, I want it to return RESULT_A, and if I pass it VALUE_B, I want it to return RESULT_B.  So here's a code excerpt :</p>
  
  <pre><code>class IsNonEmpty extends ArgumentMatcher&lt;Get&gt; {
      public boolean matches(Object get) {
          //For some reason, this method is called when I assign the IsEmpty matcher to MockHtable.get()
          //When this happens, the value of the get argument is null, so this method throws an NPE
  
          return Arrays.equals(((Get) get).getRow(), SERIALIZATION_HELPER.getValidBytes(key)); 
      }
  }
  
  class IsEmpty extends ArgumentMatcher&lt;Get&gt; {
      public boolean matches(Object get) {
          return !(Arrays.equals(((Get) get).getRow(), SERIALIZATION_HELPER.getValidBytes(key))); 
      }
  }      
  
  [...]
  
  //This line executes just fine
  Mockito.when(mockHTable.get(Mockito.argThat(new IsNonEmpty()))).thenReturn(dbResult);
  
  [...]
  
  //This line calls IsNonEmpty.matches() for some reason.  IsNonEmpty.matches() throws an NPE
  Mockito.when(mockHTable.get(Mockito.argThat(new IsEmpty()))).thenReturn(emptyResult);
  </code></pre>
  
  <p>When I assign the IsEmpty custom matcher to mockHTable.get() method, it calls the IsNonEmpty.matches() function.  No idea why it's doing this.  So I change the IsNonEmpty class to this :</p>
  
  <pre><code>class IsNonEmpty extends ArgumentMatcher&lt;Get&gt; {
      public boolean matches(Object get) {
          //For some reason, this method is called when I assign the IsEmpty matcher.  Weird, no?
          if(get == null) {
              return false;
          }
  
          return Arrays.equals(((Get) get).getRow(), SERIALIZATION_HELPER.getValidBytes(key)); 
      }
  }
  </code></pre>
  
  <p>and then everything works just fine!  IsNonEmpty.matches() is still called when I assign the IsEmpty matcher to the mockHTable.get() function, but my matchers work exactly how they should.</p>
  
  <p>So what's the deal?  Why does this happen?  Is my work-around an adequate way to compensate for this quirky behavior, or am I Doing It Wrong?</p>