camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simmons Jr, Robert" <>
Subject Is there a Method to Determine if Mock Endpoints are Real?
Date Tue, 17 Sep 2013 03:34:17 GMT

I have some camel tests using TestNG and CamelTestSupport. The problem I am having is that
I can get mock endpoints that don't exist. This makes it a pain to debug the tests with complex
routes. I was wondering if there is something like assertIsReal() to determine if a mock endpoint
is actually connected to a real endpoint in the route. For example:

    this.context.getRouteDefinition(ROUTE_ID).adviceWith(this.context, new AdviceWithRouteBuilder()


      public void configure() throws Exception {

        // mock only log endpoints





    final MockEndpoint first = getMockEndpoint("mock:activemq:queue:escalated-cases");


    final MockEndpoint xe = getMandatoryEndpoint("mock:activemq:queue:" + "blah", MockEndpoint.class);

In this case the "first" endpoint points to an actual node in the route but the xe one does
not. The problem is if I get the URI slightly wrong, I spend 20 minutes chancing ghosts to
figure out if the mock is real. It would be better if getMockEndpoint() would throw an exception
if there is no backing component.

And then the code would throw exceptions if it didn't find the real component.

Robert Simmons Jr. MSc. | Lead Java Architect | EA - Worldwide Customer Experience

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message