<分区>
我需要为类似于以下类的类编写测试用例:
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
}
我只需要测试 loadBean 方法,问题是 - 我无法使用 PowerMock 跳过对 callWebService() 的方法调用。因此,为了更清楚地解释,我需要一个测试用例,该用例调用 loadBean 但在遇到继续执行流程的 callWebService 方法时不执行任何操作。
我在同一个网站上读到我们可以用 PowerMockito 做到这一点,但无法让它工作。
请帮忙。