![](/img/trans.png)
[英]Static method mocked via EasyMock and Powermock getting invoked when calling EasyMock.expect()
[英]How to set the expect calling counts for void method when using EasyMock + PowerMock?
File mockFile = createMockAndExpectNew(File.class, fileParentPath+fileName);
RandomAccessFile mockRandomAccessFile = createMockAndExpectNew(RandomAccessFile.class, mockFile, "rw");
mockRandomAccessFile.seek(0L);
我想為此預期的void方法設置調用計數,但是我不知道該怎么辦。
要期待最后一次通話3次,可以使用expectLastCall
方法:
// mockRandomAccessFile is a mock
mockRandomAccessFile.seek(0L);
EasyMock.expectLastCall().times(3);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.