Bradford,

 

I'm having trouble responding to your original email and have had a lot of
problems with the user forum in the past few months with emails bouncing and
rejecting posts/replies. 

 

Use Mockito to easily mock the interface or bean you want injected into your
Java classes or used in your route. You can then add it to the registry via
the JNDI registry in Camel Test Support or via Camel Blueprint Test Support.
Mockito is about as simple as it gets and it let's you do some rather
powerful testing of your routes. 

 

Ranx

 

 

Does Camel have some built in functionality to replace a Bean within a 
Route while maintaining the method called on the bean? 

For instance, given the RouteBuilder below, I would like to replace myBean 
with myMockBean during testing. I've considered using AdviceWith, but that 
seams to replace the entire Bean Node rather than just the instance of the 
class used by the Bean Node. 

public class MyRouteBuilder extends RouteBuilder 
{ 
    @BeanInject 
    private MyBean myBean; 

    @Override 
    public void configure() throws Exception 
    { 
        from("direct:myEndpoint") 
            .bean(myBean, "myMethod") 
            .id("myBeanId"); 
    } 
} 



 

Reply via email to