I encountered this problem as well when I first used this. 

Because you used the star, it mocked and skipped every endpoint, including the 
start of your route. Just ensure the regex you provide doesn't match the start 
of your route. If you enable camel logging at info level, you'll see something 
like this that will tell you what has been mocked.

org.apache.camel.impl.InterceptSendToMockEndpointStrategy - Adviced endpoint 
[myuri] with mock endpoint [mock:myuri]

On 17/02/2015, at 1:23 AM, Chris Melikian <[email protected]> wrote:

> Thanks Claus, so how come:-
> 
>       @Override
>       public String isMockEndpointsAndSkip() {
>               return "*";
>       }
> 
> gives me a failure but
> 
>       @Override
>       public String isMockEndpointsAndSkip() {
>               return "direct:success";
>       }
> 
> works in my test?
> 
> I'm testing that the endpoint receives an expected message count. I can't
> see where the bug in my code is otherwise.
> 
> 
> 
> public class CloseOpenOrdersRouteTest extends CamelTestSupport {
>       
>       private CloseOpenOrdersRoute route = new CloseOpenOrdersRoute();
>       
>       @Override
>       public String isMockEndpointsAndSkip() {
>               return "direct:.*";
>       }
>       
>       @Test
>       public void closeOrderSuccessfully() throws Exception {
>               MockEndpoint to = getMockEndpoint("mock:" + 
> SuccessRoute.FROM_URI);
>               
>               template().sendBody(CloseOpenOrdersRoute.FROM_URI, "doesn't 
> matter for
> this test");
>               to.expectedMessageCount(1);
>       }
>       
>       @After
>       public void after() throws InterruptedException {
>               assertMockEndpointsSatisfied();
>       }
>       
>       @Override
>       protected RouteBuilder createRouteBuilder() throws Exception {
>               return route;
>       }
> 
> }
> 
> The class under test is:-
> 
> public class CloseOpenOrdersRoute extends RouteBuilder {
> 
>       public static final String CLOSE_OPEN_ORDERS_ROUTE_ID =
> "closeOpenOrdersRouteId";
>       public static final String FROM_URI = "direct:closeOpenOrders";
> 
>       @Override
>       public void configure() throws Exception {
>               from(FROM_URI).id(CLOSE_OPEN_ORDERS_ROUTE_ID)
>               .log("request to close open orders received")
>               .to(SuccessRoute.FROM_URI);
>       }
> 
> }
> 
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/isMockEndpointsAndSkip-documentation-unclear-tp5762798p5762813.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to