Using Mockito, how do I verify a method was a called with a certain argument?

后端 未结 3 584
旧时难觅i
旧时难觅i 2020-12-08 09:23

I\'m using Mockito 1.9.0. How would i verify that a method got called exactly once, and that one of the fields passed to it contained a certain value? In my JUnit test, I

3条回答
  •  时光说笑
    2020-12-08 10:14

    This is the better solution:

    verify(mock_contractsDao, times(1)).save(Mockito.eq("Parameter I'm expecting"));
    

提交回复
热议问题