title: Can Mockito stub a method without regard to the argument?
body: <p>I'm trying to test some legacy code, using Mockito.</p>
  
  <p>I want to stub a <code>FooDao</code> that is used in production as follows:</p>
  
  <pre><code>foo = fooDao.getBar(new Bazoo());
  </code></pre>
  
  <p>I can write:</p>
  
  <pre><code>when(fooDao.getBar(new Bazoo())).thenReturn(myFoo);
  </code></pre>
  
  <p>But the obvious problem is that <code>getBar()</code> is never called with the same <code>Bazoo</code> object that I stubbed the method for. (Curse that <code>new</code> operator!)</p>
  
  <p>I would love it if I could stub the method in a way that it returns <code>myFoo</code> regardless of the argument. Failing that, I'll listen to other workaround suggestions, but I'd really like to avoid changing the production code until there is reasonable test coverage.</p>