How to mock a call of an inner method from a Junit
<p>I have MyClass and I am doing a test-class for every method (Method1Test)</p>

<pre><code>public class MyClass {
    public int method1(){
        int a = method2();
        return a;
    }
    public int method2(){
        return 0;
    }
}

@RunWith(MockitoJUnitRunner.class)
public class Method1Test {
    @InjectMocks
    private MyClass myClass = new MyClass();
    @Before
    public void setup(){}
    @Test
    public void test01(){
        Mockito.when(myClass.method2()).thenReturn(25);
        int a = myClass.method1();
        assertTrue("We did it!!!",a==25);
    }
}
</code></pre>

<p>The problem is that I am not able to mock the call to method2 to make it return a diferent value. The Mockito sentence don't do the work.</p>

<p>Very thanks ^_^ </p>