File mockFile = createMockAndExpectNew(File.class, fileParentPath+fileName);
RandomAccessFile mockRandomAccessFile = createMockAndExpectNew(RandomAccessFile.class, mockFile, "rw");
mockRandomAccessFile.seek(0L);
我想为这个预期的void方法设置调用计数,但我不知道该怎么做。
答案 0 :(得分:3)
要预期最后一次通话3次,您可以使用expectLastCall
方法:
// mockRandomAccessFile is a mock
mockRandomAccessFile.seek(0L);
EasyMock.expectLastCall().times(3);