Unit test functions with Apache Camel Exchange as parameter

I am developing java camel and I want unit test (junit4) bunch of functions with passing Exchange as a parameter.

For instance:

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 exchange Exchange? And how to set predefined xml as incoming message inside exchange?

2> If I do not need to customize the camel test? How to set predefined xml as incoming message inside exchange using camel test.

Thank you very much.

+4
source share
2 answers

You can also create a new default exchange as follows:

  CamelContext ctx = new DefaultCamelContext(); Exchange ex = new DefaultExchange(ctx); 
+11
source

All Articles