bjsunning 2007-8-21 14:12
easy mock高手如内请教一个问题
刚使用easy mock 其中有一个次数的方法设置,
代码如下:
public void testAddAndChangeDocument()
{
mock.documentAdded("Document");
mock.documentChanged("Document");
expectLastCall().times(3);
replay(mock);
classUnderTest.addDocument("Document", new byte[0]);
classUnderTest.addDocument("Document", new byte[0]);
classUnderTest.addDocument("Document", new byte[0]);
classUnderTest.addDocument("Document", new byte[0]);
verify(mock);
}
不太明白设置expectLastCall().times(3); 有什么用,请高手指点
cwj007 2007-8-27 14:23
调用方法 expectLastCall().times(int times) 来指定最后一次调用的次数