title: how start a route in a Camel test with mocked Endpoints
body: <p>I'm starting out with Camel and I'm having some problems writing a test. My use case is exactly the same as the <a href="http://camel.apache.org/cxf-proxy-example.html">cfx proxy example</a>. Except that I don't need the "RealWebservice". Now I'm trying to write a unit test (not an integration test as included with the example), using the annotation approach:</p>
  
  <pre><code>@RunWith(CamelSpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:application-context.xml" })
  @MockEndpointsAndSkip
  public class RoutesTest {
  
  @Autowired
  CamelContext camelContext;
  
  @EndpointInject(uri = "mock:cxf:bean:cxfEndpoint", context = "camelContext")
  MockEndpoint cxfEndpoint;
  
  @EndpointInject(uri = "mock:log:input", context = "camelContext")
  MockEndpoint logInputEndpoint;
  
  @EndpointInject(uri = "mock:http:realhostname:8211/service", context = "camelContext")
  MockEndpoint realEndpoint;
  
  @EndpointInject(uri = "mock:cxf:bean:cxfEndpoint")
  ProducerTemplate producer;
  
  @Test
  public void testLeleuxMifidRoute() throws InterruptedException {
      String body = "&lt;blah/&gt;";
  
      cxfEndpoint.expectedBodiesReceived(body);
      logInputEndpoint.expectedBodiesReceived(body);
      realEndpoint.expectedBodiesReceived(body);
  
      producer.sendBody(body);
  
      MockEndpoint.assertIsSatisfied(camelContext);
  }
  }
  </code></pre>
  
  <p>The cxfEndpoint receives the message <strong>but the other endpoints don't.</strong></p>
  
  <p>The route looks like this (it works when I run it and send a message with SoapUI, obviously I obfuscated the ips and beannames in this example):</p>
  
  <pre><code>&lt;endpoint id="callRealWebService" uri="http://realhostname:8211/service?throwExceptionOnFailure=true" /&gt; 
  &lt;route&gt;
    &lt;from uri="cxf:bean:cxfEndpoint?dataFormat=MESSAGE"/&gt;
    &lt;to uri="log:input?showStreams=true"/&gt;
    &lt;to ref="callRealWebService"/&gt;
    &lt;to uri="log:output"/&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>What am I doing wrong? All the examples and other questions I found seem to use "direct:start" or change the production route.</p>