title: Mockito spy method not working
body: <p>I'm in trouble with mockito.spy method.</p>
  
  <p>I'm recently arrived on a "old" project and my first task is to add mockito in it, and to do real unit test  :)</p>
  
  <p>the project has many conception problems but its not the point here ;)</p>
  
  <p>I explain my problem:</p>
  
  <p>I have a class</p>
  
  <pre><code>public class Tutu{
    public Tutu(){
    }
  }
  
  public class Toto{
    public Toto(){
    }
    public int executeToto(Tutu tutu){
      //do some stuff
      return 5;
    }
  }
  
  public class Titi{
    private Toto toto;
  
    public Titi(){
       this.toto = new Toto();     
    }
  
    public void executeTiti(){
        //do some stuff
        Tutu tutu = new Tutu();
        int ret = this.toto.executeToto(tutu);
        //do some stuff
    }
  }
  </code></pre>
  
  <p>in my test class TitiTest.java I want to test only executeTiti, I don't want to test executeToto stuff because this class has is own test class TotoTest.java.</p>
  
  <p>but as you can see, toto is instantiate in titi constructor so I try something like this:
  (I'm using PowerMock in my test too, so I'm using PowerMockRunner but it doesn't seem to be the problem)</p>
  
  <pre><code>@RunWith(PowerMockRunner.class)
  public class TitiTest {
  
   @Test
   public void testExecuteTiti(){
     Toto toto = Mockito.spy(new Toto());
     Mockito.doReturn(2).when(toto).executeToto(Mockito.any(Tutu.class));
  
     Titi testedObject = new Titi();
     testedObject.executeTiti();
   }
  }
  </code></pre>
  
  <p>but the real method is always calling and ret = 5 everytime :(</p>
  
  <p>Do I miss something? I read many post about this on stackoverflow and try all solution but it's never work because I think I'm doing right thing.</p>
  
  <p>I use junit4.11/powermock1.5.4/mockito1.9.5</p>