title: Using Mockito spy to mock a method without specifying the exact argument
body: <p>I have a use case where I have to test the real method which calls a method inside. This inner method has to be mocked. For instance,</p>
  
  <pre><code>Class Sample {
     boolean method(Foo foo) {
       return innerMethod(new Goo(foo));
     }
  }
  </code></pre>
  
  <p>So I want to do the following.</p>
  
  <pre><code>Sample sample = Mockito.spy(new Sample());
  Foo foo = new Foo();
  doReturn(false).when(sample).innerMethod(new Goo(foo));
  
  assertEquals(false, sample.method(foo));
  </code></pre>
  
  <p>The problem is, I suppose, the inner method is never mocked since the arguments <code>Goo</code> are not the same objects. How do I get around this problem?</p>