title: Mockito - Custom Matcher throws NPE when trying to match primitive
body: <p>Trying to figure out how to write a custom matcher for a primitive value.  Say I've got the following custom matcher:</p>
  
  <pre><code>class IsEven extends ArgumentMatcher&lt;Integer&gt; {
      public boolean matches(Object i) {
          return ((Integer) i) % 2 == 0;
      }
  }
  </code></pre>
  
  <p>And I run the following test.  'mocked' is an already-mocked instance of a class that has a method 'someMethod':</p>
  
  <pre><code>@Test
  public void primatives() {
  
      mocked.someMethod(2);
  
      ArgumentMatcher&lt;Integer&gt; customMatcher = new IsEven();
  
      // ! Throws NPE !
      Mockito.verify(mocked).someMethod(Mockito.argThat(customMatcher));
  
  }
  </code></pre>
  
  <p>The reason for the NullPointerException is that the Mockio.argThat method always returns a null, which I'm guessing cannot be autoboxed back into an integer.</p>
  
  <p>I feel as though this woudl be a common use case - any advice?</p>
  
  <p>Thanks,
  Roy</p>