title: How do Mockito matchers work?
body: <p>Mockito argument matchers (such as <code>any</code>, <code>argThat</code>, <code>eq</code>, <code>same</code>, and <code>ArgumentCaptor.capture()</code>) behave very differently from Hamcrest matchers.</p>
  
  <ul>
  <li><p>Mockito matchers frequently cause InvalidUseOfMatchersException, even in code that executes long after any matchers were used.</p></li>
  <li><p>Mockito matchers are beholden to weird rules, such as only requiring the use of Mockito matchers for all arguments if one argument in a given method uses a matcher.</p></li>
  <li><p>Mockito matchers can cause NullPointerException when overriding <code>Answer</code>s or when using <code>(Integer) any()</code> etc.</p></li>
  <li><p>Refactoring code with Mockito matchers in certain ways can produce exceptions and unexpected behavior, and may fail entirely.</p></li>
  </ul>
  
  <p>Why are Mockito matchers designed like this, and how are they implemented?</p>