Unit testing processors and Bean Bindings
When developing complex Processor
implementations, it is useful to test them in isolation to ensure that they are fully exercised—something that may not necessarily be straightforward in a production route. Likewise, when developing Java classes marked with Camel annotations for bean binding, you want to check the binding logic as well as logic contained within the class. This recipe presents an approach for testing these types of scenarios.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.examples.testing.exchange
package.
How to do it...
Processors are typically used for composite actions that involve modifying the body of an exchange as well as a number of headers. Here is a Processor
implementations process()
method that we would like to test:
@Override public void process(Exchange exchange) throws Exception { final String something = "SOMETHING"; Message in = exchange.getIn(); String action = in.getHeader("action...