How to verify multiple method calls with different params

前端 未结 7 1684
自闭症患者
自闭症患者 2020-12-13 08:14

I have the following method that I wish to verify behaviour on.

public void methodToTest(Exception e, ActionErrors errors) {
    ...

    errors.add("exc         


        
7条回答
  •  遥遥无期
    2020-12-13 08:32

    If the order of both add() calls is relevant, you can use InOrder:

    InOrder inOrder = inOrder(errors);
    inOrder.verify(errors).add(eq("exception.message"), any(ActionError.class));
    inOrder.verify(errors).add(eq("exception.detail"), any(ActionError.class));
    

提交回复
热议问题