Is there an already built-in, standard way in JMock to capture method arguments to test the argument object later on with standard JUnit functionality?
Something like
final CapturedContainer<SimpleMailMessage>capturedArgumentContainer = new ...
context.checking(new Expectations() {{
oneOf(emailService.getJavaMailSender()).send(
with(captureTo(capturedArgumentContainer)));
}});
assertEquals("helloWorld", capturedArgumentContainer.getItem().getBody());
CapturedContainer
and captureTo
do not exist — they are what I'm asking for.
Or do I need to implement this on my own?