I am doing java camel development and I want to unit test(junit4) a bunch of functions with Exchange being passed in as parameter.
For example :
public finalObject getProperty(final Exchange exchange, final String property) throws Exception {
//all about getting property from xml message in exchange via xpath
}
Question: 1>Can I use EasyMock to mock Exchange ? And how to set a predefined xml as incoming message inside the exchange ?
2>If not do I need to setup camel test ? How to set a predefined xml as incoming message inside the exchange with camel test.
Thanks a lot.
You can also create a new default exchange like this:
CamelContext ctx = new DefaultCamelContext();
Exchange ex = new DefaultExchange(ctx);