I was wondering if there is more elegant way to verify the arguments other than using a class that extends ArgumentMatcher?
Thanks.
Are you looking for ArgumentCaptor
as a way of doing this? Refer to http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#captors . This lets you perform whatever checks you like on the values that were passed to your mock's methods. It's often much simpler than setting up an ArgumentMatcher
.