You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/05/21 08:48:49 UTC

[jira] Resolved: (CAMEL-2061) Make MockEndpoint double as a bean for use in Camel route tests

     [ https://issues.apache.org/activemq/browse/CAMEL-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-2061.
--------------------------------

    Resolution: Fixed

trunk: 946905

> 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
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.4.0
>
>
> 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.