0
class CommandRunner {
String output;
public int run(String command) {
//runs command and sets output
return errCode;
}
public String getOutput() {
return output;
}
}
以上CommandRunner在我的課測試是作爲
CommandRunner runner;
runner.run("some command");
out = runner.getOutput();
//operates on out
runner.run("some command");
out = runner.getOutput();
//operates on out
runner.run("some command");
out = runner.getOutput();
//operates on out
我怎麼能嘲笑CommandRunner返回不同的輸出基於輸入run()方法?我用Mockito使用Power Mock。