camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shyenuganti <>
Subject Questions about testing came routes
Date Mon, 25 Feb 2013 22:51:56 GMT
I am going through this example in the documentation:
public class FilterTest extends CamelTestSupport {

    @EndpointInject(uri = "mock:result")
    protected MockEndpoint resultEndpoint;

    @Produce(uri = "direct:start")
    protected ProducerTemplate template;

    public void testSendMatchingMessage() throws Exception {
        String expectedBody = "<matched/>";
        template.sendBodyAndHeader(expectedBody, "foo", "bar");

    public void testSendNotMatchingMessage() throws Exception {
        template.sendBodyAndHeader("<notMatched/>", "foo",

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {

In this test, we are testing a route 

But in the test class, we are overriding the RouteBuilder to insert a copy
of our prodcution route into the context which replaces the original
production route for the sake of testing. 

This test works fine here. But I have a question. 

If the original production route is changed, that changes will not be
reflected in our test route as we are duplicating the whole route in the
unit test. Then, the unit test will never fail even if we delete the
original route itself and this test will never fail. 

We use a test to check for any discrepancies in our routes. If the test
never fails even if change the production route, what is the use of having
this test in the first place? Am I missing anything in this whole concept.
Can anyone help me to understand this camel route testing?

Thank you.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message