I want to test the ClassToTest
class for it's method methodToTest
. But I am not able to make it as the private method anotherMethod
which is being called by the methodToTest
has some dependency with the value returned by the singleton class SingletonClass
using its public method getName
.
I tried using powermock's privateMethod mock and static method mock and all, but no help.
Does anyone have a solution for this scenario?
Class ClassToTest{
public void methodToTest(){
...
anotherMethod();
...
}
private void anotherMethod(){
SingletonClass singletonObj = SingletonClass.getInstance();
String name = singletonObj.getName();
...
}
}