【发布时间】:2012-10-23 11:44:09
【问题描述】:
我正在尝试使用 easyMock 运行一个简单的测试:
public class Class1 implements Interface1{
public void method1(Object obj){
if(isEnable()){
doSmth();
}
}
public boolean isEnable(){
return isEnable;
}
}
我的测试:
Interface1 test1= Interface1(Class1.class);
test1.method1(anyObject);
expectLastCall();
expect(test1.isEnable).andReturn(true);
replay(test1);
test1.method1(new Object());
verify(test1);
错误:
验证时预期失败: isEnable():预期:1,实际:0
问题出在哪里?我已经阅读了大量示例,其中发送的参数存在类似问题,但不是没有参数example1 或这个tutorial 的方法,我觉得这很有趣
提前致谢
【问题讨论】:
标签: easymock