title: Apache Camel Spring Javaconfig Unit Test No consumers available on endpoint
body: <p>I have the following route configuration:</p>
  
  <pre><code>@Component
  public class MyRoute extends RouteBuilder {
      @Override
      public void configure() throws Exception {
          from("direct:in").to("direct:out");
      }
  }
  </code></pre>
  
  <p>When I try to test it:</p>
  
  <pre><code>@RunWith(CamelSpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = { MyRouteTest.TestConfig.class }, loader = CamelSpringDelegatingTestContextLoader.class)
  @MockEndpoints
  public class MyRouteTest {
      @EndpointInject(uri = "mock:direct:out")
      private MockEndpoint mockEndpoint;
  
      @Produce(uri = "direct:in")
      private ProducerTemplate producerTemplate;
  
      @Configuration
      public static class TestConfig extends SingleRouteCamelConfiguration {
          @Bean
          @Override
          public RouteBuilder route() {
              return new MyRoute();
          }
      }
  
      @Test
      public void testRoute() throws Exception {
          mockEndpoint.expectedBodiesReceived("Test Message");
  
          producerTemplate.sendBody("Test Message");
  
          mockEndpoint.assertIsSatisfied();
      }
  }
  </code></pre>
  
  <p>I get this exception:</p>
  
  <blockquote>
    <p>org.apache.camel.component.direct.DirectConsumerNotAvailableException:
    No consumers available on endpoint: Endpoint[direct://out].
    Exchange[Message: Test Message]</p>
  </blockquote>
  
  <p>It looks like the Mock is not picking up the message from the endpoint.</p>
  
  <p>What am I doing wrong?</p>