title: Setting up Mock Endpoints in Apache Camel with log:*
body: <p>I have several routes that end with a log uri such as</p>
  
  <pre><code>&lt;route&gt;
      &lt;from uri="someUri" /&gt;
      &lt;to uri="someProcessor" /&gt;
      &lt;to uri="log:SOME_LOG?level=INFO" /&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>I am using <code>CamelSpringJUnit4ClassRunner</code> to run my unit tests.</p>
  
  <p>I want to be able to mock my log endpoints as MockEndpoint objects. I have tried to use </p>
  
  <p><code>@MockEndpoints("log:*")</code></p>
  
  <p>along with</p>
  
  <pre><code>end = MockEndpoint.resolve(camelContext, "log:SOME_LOG?level=INFO");
  </code></pre>
  
  <p>but that generates a ClassCastException cannot cast InterceptSendToEndpoint to MockEndpoint.</p>
  
  <p>and also tried</p>
  
  <pre><code>@EndpointInject(uri="log:SOME_LOG?level=INFO")
  MockEndpoint end;
  </code></pre>
  
  <p>but that also generates an IllegalArgumentException.</p>
  
  <pre><code>Invalid type: org.apache.camel.component.mock.MockEndpoint which cannot be 
  injected via @EndpointInject/@Produce for: Endpoint[log:SOME_LOG?level=INFO]
  </code></pre>
  
  <p>A workaround I've found is by prepending my log uri with "mock:" and using </p>
  
  <p><code>@EndpointInject(uri="mock:log:SOME_LOG?level=INFO)</code> and defining my route in xml with</p>
  
  <pre><code>&lt;route&gt;
      &lt;from uri="someUri" /&gt;
      &lt;to uri="someProcessor" /&gt;
      &lt;to uri="mock:log:SOME_LOG?level=INFO" /&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>However I would like to get this to work by mocking my log: uris and not having to modify my route definitions in camel.xml.</p>
  
  <p>Is there something that I'm missing?</p>