Mockito verify after exception Junit 4.10

前端 未结 4 1152
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 22:19

I am testing a method with an expected exception. I also need to verify that some cleanup code was called (on a mocked object) after the exception is thrown, but it looks li

4条回答
  •  暖寄归人
    2020-12-05 23:02

    I haven't tried this yet, but in addition to Jeff Bowman's excellent answer, you might have the choice to use the ExpectedException Rule with a try... finally construct, placing your verify statement in the finally block.

提交回复
热议问题