I am experimenting with moving an application over from Blueprint to Spring Boot. I have set up two routes.
Route A and tests work fine. Route B I am unable to receive an exchange on mock:out to satisfy mockOut.expectedMessageCount(1); and I get java.lang.AssertionError: mock://out Received message count. Expected: <1> but was: <0> Expected :<1> Actual :<0> Here is the route: @Component public class RouteB extends RouteBuilder{ @Override public void configure() throws Exception { from("direct:RouteB") .routeId("RouteB") .log(LoggingLevel.INFO, "Received Body: ${body}").id("log-input") .setBody().simple("Who lives at ${body}") .log(LoggingLevel.INFO, "Converted Body: ${body}").id("log-result") ; } } and here is the test that's failing. @RunWith(CamelSpringBootRunner.class) @SpringBootTest(classes = SpringBootCamelVanilla.class) public class RouteBTests extends CamelTestSupport { @Autowired private CamelContext context; @Autowired private ProducerTemplate template; @Override public boolean isUseAdviceWith() { return true; } @Test public void whereIsBuckinghamPalaceTest() throws Exception { context.getRouteDefinition("RouteB") .adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:in"); // send the outgoing message to mock:output weaveAddLast().to("mock:out"); } }); context.start(); MockEndpoint mockOut = getMockEndpoint("mock:out"); mockOut.expectedMessageCount(1); template.sendBody("direct:in","Buckingham Palace"); assertMockEndpointsSatisfied(); } } I can see from the logs: INFO 51857 --- [ main] mydomain.springbootcamel.RouteBTests : Skipping starting CamelContext as isUseAdviceWith is set to true. INFO 51857 --- [ main] o.a.camel.impl.DefaultShutdownStrategy : Starting to graceful shutdown 1 routes (timeout 10 seconds) INFO 51857 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy : Route: RouteB shutdown complete, was consuming from: direct://RouteB INFO 51857 --- [ main] o.a.camel.impl.DefaultShutdownStrategy : Graceful shutdown of 1 routes completed in 0 seconds INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Route: RouteB is stopped, was consuming from: direct://RouteB INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Route: RouteB is shutdown and removed, was consuming from: direct://RouteB INFO 51857 --- [ main] o.apache.camel.builder.AdviceWithTasks : AdviceWith replace input from [direct:RouteB] --> [direct:in] INFO 51857 --- [ main] o.apache.camel.builder.AdviceWithTasks : AdviceWith (*) : [Log[Converted Body: ${body}]] --> after [pipeline -> [[To[mock:out]]]] INFO 51857 --- [ main] org.apache.camel.model.RouteDefinition : AdviceWith route after: Route(RouteB)[[From[direct:in]] -> [Log[Received Body: ${body}], SetBody[simple{Who lives at ${body}}], Log[Converted Body: ${body}], pipeline -> [[To[mock:out]]]]] INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Route: RouteB started and consuming from: direct://in INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.2 (CamelContext: camel-1) is starting INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started. INFO 51857 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.18.2 (CamelContext: camel-1) started in 0.000 seconds INFO 51857 --- [ main] o.a.c.i.converter.DefaultTypeConverter : Loaded 196 type converters INFO 51857 --- [ main] RouteB : Received Body: Buckingham Palace INFO 51857 --- [ main] RouteB : Converted Body: Who lives at Buckingham Palace INFO 51857 --- [ main] o.a.camel.component.mock.MockEndpoint : Asserting: mock://out is satisfied INFO 51857 --- [ main] mydomain.springbootcamel.RouteBTests : ******************************************************************************** INFO 51857 --- [ main] mydomain.springbootcamel.RouteBTests : Testing done: whereIsBuckinghamPalaceTest(mydomain.springbootcamel.RouteBTests) INFO 51857 --- [ main] mydomain.springbootcamel.RouteBTests : Took: 10.051 seconds (10051 millis) Is this the correct unit test approach for spring-boot? I can see other examples in camel-examples where they use autowired but I cannot see how this works if you have multiple routes in an application. Any suggestions gratefully received. O. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-2-18-2-Spring-Boot-Unit-Tests-Does-mockOut-expectedMessageCount-work-tp5794070.html Sent from the Camel - Users mailing list archive at Nabble.com.