title: Mockito: mock instance method for all instances of a class
body: <p>I'm trying to stub an instance method of a particular class, so that when any instance of this <code>Foo</code> class calls this instance method <code>doSomething</code>, the same <code>object</code> is returned (see code below). However, mockito doesn't allow any matchers outside of verification or stubbing.</p>
  
  <pre><code>Bar object = new Bar();
  given(any(Foo.class).doSomething(Arg.class)).willReturn(object);
  </code></pre>
  
  <p>And in <code>Foo.class</code>:</p>
  
  <pre><code>Bar doSomething(Arg param) {
      Bar bar = new Bar();
      // Do something with bar
      return bar;
  }
  </code></pre>
  
  <p>Any way I can achieve this goal with Mockito? Thanks!</p>