Another thing you can do is to substitute some endpoints in the
context like this (assuming you use ContextTestSupport):
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
camelContext.addEndpoint("jms:in.queue", new
DirectEndpoint<Exchange>("jms:in.queue"));
camelContext.addEndpoint("http://www.cnn.com/", new
MockEndpoint("http://www.cnn.com/"));
return camelContext;
}
Of course it works for endpoints only, but might be enough. You can
always attach processors to mock endpoint then, but the point is, that
you can test your business flow without explicitly using mock
component.
Roman
2009/4/22 Peter Maas <[email protected]>:
> Hi,
>
> is it possible the programmatically replace parts of a route (for testing
> purposes) to temporarily add processor in the middle of the route for
> example? One case I (think) I need it for is for testing unexpected errors,
> I'd like to mimic this by 'injecting' a processor which throws a unchecked
> exception; the ErrorHandlerTest does do this but only with custom routes...
>
> any ideas?
>
> Peter
>
>
>
>
>