I have been doing a bit of reading around argument captor and the more I read about it, the more I get lost. Can someone take the pain of explaining it with an example?
According to docs, this is deprecated. You should use factory method forClass(Class) to create captors instead to avoid NullPointerExceptions. see here
Example:
ArgumentCaptor<Person> argument = ArgumentCaptor.forClass(Person.class);
verify(mock).doSomething(argument.capture());
assertEquals("John", argument.getValue().getName());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With