I have configured apache camel redelivery policy to one the camel routes. I need to write junit's to verify if the route is working properly in both success and failure scenarios.
I was able to write junit for the failure scenario and was able to verify that the maximum redelivery happened as per the configuration by mocking an service in the route to return an exception.
In positive scenario I want to mock a service in the route to return an exception on the first 3 attempts and on the last redelivery attempt (4) I want the mock service to return expected value without any exception. (3 attempts failed, but on 4th attempt it was success)
I did bit a research on this and couldn't find any solution on this, is there any way we can get hold of camel redelivery instance and change the mocks at run time during the test execution ?