Make MockEndpoint double as a bean for use in Camel route tests
---------------------------------------------------------------

                 Key: CAMEL-2061
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2061
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-core
    Affects Versions: 2.0.0
            Reporter: Chris Purcell
             Fix For: Future


The following class turns a MockEndpoint into a very capable bean for use in 
Camel route unit tests:

public class MockEndpointBean extends MockEndpoint {
    @Handler
    public void handle(Exchange exchange) throws Exception {
        onExchange(exchange);
    }
}

If this public method were added to MockEndpont, the subclass would not be 
necessary. A Spring Camel route could use the following bean:

    <bean id="myBean" class="org.apache.camel.component.mock.MockEndpoint" />

and inject the endpoint into any unit test:

    @EndpointInject
    private MockEndpoint myBean;

and then control the behaviour of the bean like any other MockEndpoint using 
the powerful when and assert methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to