I am writing a test for my error handling. The route I am testing uses JMS
and therefore has URL properties that are not compatible with the direct
component. The way I have it set up is that I pass the following to the
Route Builder ("jms:queue:myqueue") and then it adds the additional URL
properties. In the test env I would like to be able to pass in something
like "direct:jmsInputChan" but this fails due to the URL properties not
working with direct.

Then I found stub. I can pass in "stub:blahblah" and get the route set up
and tested no problem. However, if I set a configuration to throw an
exception in the route I don't get the exception out. 

Here is what I mean... I am using ProducerTemplate.sendBody to send in a
message. If this channel is a "direct:xyz" and an exception is thrown the
exception is logged by Camel and then thrown out of sendBody which means I
can catch the exception in my test or have the test fail because of the
exception.

However, when the route starts with a stub and I cause the exception, Camel
logs the exception but it is NOT thrown out of sendBody. This makes it hard
to verify that the exception was not handled.

It seems that stub should behave similar to direct in this regard.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-doesn-t-the-stub-component-throw-exceptions-in-tests-tp5733041.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to