I need to write a test case for a class similar to the following class:
public class TestClass {
public String loadBean(int i) {
String s = null;
if (i <= 0) {
s = "less";
// call some webservice that we don't need to test
callWebService(s);
} else {
s = "more";
}
return s;
}
private void callWebService(String s) {
//Some complex code here
}
I need to test loadBean method only, problem is - i'm not able to skip method call to callWebService(), using PowerMock. So to explain more clearly I need to a test case which calls loadBean but do nothing when it encounters callWebService method continuing the execution flow.
I read it on this same site that we can do it with PowerMockito but could not get it to work.
Please help.