title: Mockito.when() not working
body: <p>I am trying to mock a call to a protected method of one of my classes:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>import com.couchbase.client.java.view.Stale; // an enum
  import com.google.common.base.Optional;
  
  public class MyClass {
    public List&lt;String&gt; myList(Optional&lt;Integer&gt; arg1, Optional&lt;Stale&gt; arg2) {
      ...
    }
  }
  </code></pre>
  
  <p>The mock shall be accomplished in the following way:</p>
  
  <pre class="lang-java prettyprint-override"><code>// Providing types for any() does not change anything
  Mockito.when(myClass.myList(Mockito.any(), Mockito.any()).thenReturn(new ArrayList());
  </code></pre>
  
  <p>Whenever the previous line is executed the actual <code>myList()</code> method is called with null values for <code>arg1</code> and <code>arg2</code>. Why is the method called, at all? After all, I am trying to avoid any executing thereof...</p>