Let's say I have a class A, which has two methods. I have to test a method, which internally calls the other method.
class A {
private void method1() {
//some steps to be done
}
public void method3() {
//some steps
}
public void method2() {
method1();
if (XUtil.isSupportRequired) {
method3();
}
}
}
So, If I try to test method2, how to mock method1, as it is not public. Any help would be appreciated. I am using junit and mockito.