Reputation: 11081
I need to mock this code
rabbitTemplate.convertAndSend(message, m -> {
m.getMessageProperties().getHeaders().put("type", HEADER);
return m;
});
I my test I write
doNothing().when(rabbitTemplate).convertAndSend(anyObject(), any(MessagePostProcessor.class));
There is an error
Any ideas about workaround?
Upvotes: 0
Views: 5746
Reputation: 27048
Instead of using anyObject()
. Try specifying the type.
doNothing().when(rabbitTemplate).convertAndSend(Mockito.any(String.class), any(MessagePostProcessor.class));
Upvotes: 3