From Mockito Documentation:
Use it to capture argument values for further assertions.
Mockito verifies argument values in natural java style: by using an equals() method. This is also the recommended way of matching arguments because it makes tests clean & simple. In some situations though, it is helpful to assert on certain arguments after the actual verification. For example:
ArgumentCaptor argument = ArgumentCaptor.forClass(Person.class);
verify(mock).doSomething(argument.capture());
assertEquals(“John”, argument.getValue().getName());
Here is a simple example where we test that the JMS producer was called with a
particular person object.
Test for testing out the InviteToConference#joinConference method.