camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Purcell (JIRA)" <j...@apache.org>
Subject [jira] Created: (CAMEL-2061) Make MockEndpoint double as a bean for use in Camel route tests
Date Mon, 12 Oct 2009 08:41:52 GMT
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.


Mime
View raw message