Hi,

Can't you inject the ProducerTemplate instead of creating it directly from
the camel context? Then mocking it would be easy. I will suggest to do the
same with the CamelContext is you really need to. But a Camel test is
usually using a real context in which you put the routes you need.

Regard,
Henri


On 4 November 2012 10:13, vinayks <[email protected]> wrote:

> Hi,
>
> I would like to unit test my following piece of code. I would like to know
> how to mock the ProducerTemplate and CamelContext.
>
> DefaultExchange exchange = new DefaultExchange(camelContext);
>                 //Set the inputs required by the routes as the
> properties...
>                 exchange.setProperty("PERSON_ID", id);
>         myProducerTemplate = camelContext.createProducerTemplate();
>         Exchange orchestatedExchange =
> cartProducerTemplate.send("direct:start", exchange);
>
> appreciate pointers to resources.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Unit-Testing-Support-for-Camel-Routes-tp5722098.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to