Is it possible to fetch/store what arguments were used when using Mockito.when?
For example this pseudo code:
Mockito.when(mock.someMethod(**any string**)).thenReturn(print(** any string **));
print would be:
public void print(String s) {
System.out.println(s);
}
Which could be used like this:
Person mockPerson = ...
mockPerson.setName("John");
Which would trigger that ‘John’ would be printed to std out.
Maybe a lame example, but I want to “store”/”use” any arguments the mocked-method would have been called with.
Follow-up question: If not, what other testing frameworks can do this.
ArgumentCaptor documentation could be interesting for you.