I would like to verify that my method is invoked with different arguments in a fixed order.
I’ve tried this:
org.mockito.Mockito.verify(mock).myMethod(arg1);
org.mockito.Mockito.verify(mock).myMethod(arg2);
//was myMethod called with arg1 before it was called with arg2?
but that does not take order into account.
Is there an easy way to do this?
Mockito provide InOrder to verify call in orders
take a look this document : Verification in order
example :
last two line will verify mock object been called in that order and arguments.