I simply use
context.getRouteDefinition(routeId).adviceWith(context,
new AdviceWithRouteBuilder() {
@Override
public void configure() {
weaveById(endpointId).selectFirst().replace().to(newUri);
}
});
Debugging the test I can see that the the endpoint IS being mocked:
AdviceWithTasks INFO AdviceWith (smtpEndpoint) :
[To[smtp://localhost:25]] --> replace [pipeline -> [[To[mock:send]]]]
But later in the debug output I find that the mock is not being used:
DefaultComponent DEBUG Creating endpoint
uri=[smtp://localhost:25], path=[localhost:25], parameters=[{}]
BlueprintCamelContext DEBUG smtp://localhost:25 converted to
endpoint: Endpoint[smtp://localhost:25] by component:
org.apache.camel.component.mail.MailComponent@56e2aeb0
--
View this message in context:
http://camel.465427.n5.nabble.com/Mocking-an-endpoint-within-a-try-catch-block-tp5727081p5727089.html
Sent from the Camel - Users mailing list archive at Nabble.com.