Mock not found in the registry for Camel route test
<p>I am trying to test a Camel route (polling messages from an SQS queue) containing</p>

<pre><code>.bean("messageParserProcessor") 
</code></pre>

<p>where <code>messageParserProcessor</code> is a Processor.<br>
The test:</p>

<pre><code>public class SomeTest extends CamelTestSupport {

    private final String queueName = ...;
    private final String producerTemplateUri = "aws-sqs://" + queueName + ...;

    private static final String MESSAGE_PARSER_PROCESSOR_MOCK_ENDPOINT = "mock:messageParserProcessor";

    @EndpointInject(uri = MESSAGE_PARSER_PROCESSOR_MOCK_ENDPOINT)
    protected MockEndpoint messageParserProcessor;

    @Override
    public boolean isUseAdviceWith() {
        return true;
    }

    @Before
    public void setUpContext() throws Exception {
        context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint("bean:messageParserProcessor")
                    .skipSendToOriginalEndpoint()
                    .process(MESSAGE_PARSER_PROCESSOR_MOCK_ENDPOINT);
            }
        });
    }

    @Test
    public void testParser() throws Exception {
        context.start();
        String expectedBody = "test";

        messageParserProcessor.expectedBodiesReceived(expectedBody);

        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody(producerTemplateUri, expectedBody);

        messageParserProcessor.assertIsSatisfied();
        context.stop();
    }
}
</code></pre>

<p>When I run the test I get this error:</p>

<pre><code>org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at:
&gt;&gt;&gt; InterceptSendToEndpoint[bean:messageParserProcessor -&gt; [process[ref:mock:messageParserProcessor]]] &lt;&lt;&lt; in route: Route(route1)[[From[aws-sqs://xxx... 
because of No bean could be found in the registry for: mock:messageParserProcessor of type: org.apache.camel.Processor
</code></pre>

<p>Same error if I replace <code>interceptSendToEndpoint(...)</code> with <code>mockEndpointsAndSkip("bean:messageParserProcessor")</code>  </p>

<p>The test can be executed (but obviously doesn't pass) when I don't use a mock:</p>

<pre><code>interceptSendToEndpoint("bean:messageParserProcessor")
    .skipSendToOriginalEndpoint()
    .process(new Processor() {
        @Override
        public void process(Exchange exchange) throws Exception {}
     });
</code></pre>

<p>So the problem is the mock that is not found, what is wrong in the way I create it?</p>