Can anyone please provide me an example showing how to use the org.mockito.ArgumentCaptor
class and how it is different from simple matchers that are p
The steps in order to make a full check are:
Prepare the captor :
ArgumentCaptor someArgumentCaptor = ArgumentCaptor.forClass(SomeArgumentClass.class);
verify the call to dependent on component (collaborator of subject under test) times(1), is the default value, so ne need to add it.
verify(dependentOnComponent, times(1)).send(someArgumentCaptor.capture());
times(1) is the default, so no need to add it.
Get the argument passed to collaborator
SomeArgumentClass someArgument = messageCaptor.getValue();
someArgument can be used for assertions