Hi,

I am slightly tweaking the code example of chapter 6 of "camel in action"
(code enclosed below). On adding Thread.sleep(), the subsequent assertion is
failing:
     java.lang.AssertionError: mock://quote Body of message: 0. Expected:
<Camel rocks> but was: <null>

Any clue on why this is happening? And what can be done so that the
assertion succeeds?

Thanks,
Sharad Goklani

-- begin --
package xxx;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

public class FirstMockTest extends CamelTestSupport {
        @Override
        protected RouteBuilder createRouteBuilder() throws Exception {
                return new RouteBuilder() {
                        @Override
                        public void configure() throws Exception {
                                from("jms:topic:quote").to("mock:quote");
                        }
                };
        }
        
        @Override
        protected CamelContext createCamelContext() throws Exception {
                CamelContext context = super.createCamelContext();
                context.addComponent("jms", context.getComponent("seda"));
                return context;
        }
        
        @Test
        public void testQuote() throws Exception {
                MockEndpoint quote = getMockEndpoint("mock:quote");
                
                template.sendBody("jms:topic:quote", "Camel rocks");

                //If i sleep, assertion fails!
                Thread.sleep(1000);
                quote.expectedBodiesReceived("Camel rocks");
                quote.assertIsSatisfied();
                quote.expectedMessageCount(1);
                quote.assertIsSatisfied();
        }
}
-- end --



--
View this message in context: 
http://camel.465427.n5.nabble.com/Mock-Endpoint-behavior-on-sleep-tp5733002.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to