In my application, I have code that looks like -
request.setParameter("a",false);//line1
request.setParameter("b",someObject);//line2
request.setParameter("c",someObject);//line3
request.setParameter("d",someObject);//line4
I have mocked the request object and now I want to verify if the line3 was invoked or not. I do not care about the other lines, in the test class I tried-
Mockito.verify(request).setParameter("c",someObject)
, however I get error -
Argument(s) are different! Wanted:
request.setParameter("c",com.test.MyObject@fec107);
-> at XXX
Actual invocation has different arguments:
request.setParameter("a", false);
For some reason, Mockito compares the first invocation and throws error