I have class named A that contains private method name a(). Another class, named B() contains public method name b() that called by a().
I'm trying to mock b() and to change his return value by using PowerMocito().
public class A() {
private void a(){
// logic
b();
// logic
}
}
public class B() {
public int b() {
return 0;
}
My Test method looks like:
@Test
public void TestB() {
// logic
B mock = PowerMockito.mock(B.class);
PowerMockito.when(mock.b()).thenReturn(1);
}
The code compiles, but I'm hoping to get 1 but the method returns 0.