How to test void methods using EasyMock

前端 未结 2 1656
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 23:30

I\'ve seen a few questions out there regarding this but I can\'t seem to make sense of any of the answers for my particular problem.

I have a mock object, lets call

相关标签:
2条回答
  • 2021-01-03 23:36

    If things haven't changed in the last few years, you use expectLastCall when setting up your expectations.

    object1.toggleDisplay();
    object.expectLastCall();
    
    0 讨论(0)
  • 2021-01-03 23:50
    object1.toggleDisplay();
    EasyMock.expectLastCall().times(5);
    

    or if you import statically the EasyMock methods:

    import static org.easymock.EasyMock.*;
    
    [...]
    
    object1.toggleDisplay();
    expectLastCall().times(5);
    
    0 讨论(0)
提交回复
热议问题