Thanks Henri. I don't want to test the actual route. I have a separate tests to test the routes. I am writing mock junits for the method where I invoke this route.
Thanks, Vinay On 04-Nov-2012, at 3:05 PM, "Henri Tremblay [via Camel]" <[email protected]> wrote: > 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 <[hidden email]> 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. > > > > > If you reply to this email, your message will be added to the discussion > below: > http://camel.465427.n5.nabble.com/Unit-Testing-Support-for-Camel-Routes-tp5722098p5722105.html > To unsubscribe from Unit Testing Support for Camel Routes, click here. > NAML -- View this message in context: http://camel.465427.n5.nabble.com/Unit-Testing-Support-for-Camel-Routes-tp5722098p5722115.html Sent from the Camel - Users mailing list archive at Nabble.com.
