title: Camel unit testing with MockEndPointsandSkip
body: <p>Am a Camel newbie and am trying out some code to understand how the MockEndpoints functionality works, but it is not working. Here are my Camel routes that I want to unit test using MockEndpoints. The property values are defined in the application.properties file.</p>
  
  <pre><code>from("kafka:{{kafka.servers}}?topic={{kafka.consumer.topic}}&amp;groupId={{kafka.consumer.groupId}}")
      .to("direct:notify");
  
  from("direct:notify")
      .log("direct:notfy");
  </code></pre>
  
  <p>Here is my Test code which is failing the assertion of receiving 1 Exchange. It appears that the Producer is never sending the message to my Kafka Mockendpoint:</p>
  
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest
  @MockEndpointsAndSkip("kafka:{{kafka.servers}}?*|direct:notify")
  public class NotificationApplicationTests {     
  
      @Autowired
      private CamelContext context;
  
      @Value("${kafka.servers}")
      private String kafkaServers;
  
      @EndpointInject(uri="mock:kafka:{{kafka.servers}}")
      private MockEndpoint mockKafka;
  
      @EndpointInject(uri="mock:direct:notify")
      private MockEndpoint mockDirect;
  
      @Autowired
      private ProducerTemplate notiProducer;
  
      @Test
      public void testMockEndpoints() throws Exception{                                       
  
          mockDirect.setExpectedMessageCount(1);
          mockDirect.whenAnyExchangeReceived( (Exchange exchange) -&gt; {
              //NEVER GETS HERE!!
              log.info("MOCK DIRECT exchange received");          
          });     
  
          String payload = "{'email': 'test@gmail.com', 'data': 'ABC1234'}";
  
          notiProducer.sendBody(mockKafka, payload);
  
          mockDirect.assertIsSatisfied();
  
      }
  
  }
  </code></pre>