I've been reading over all of the test documentation and Mock documentation. It seems that I should be able to just setup a mock endpoint for the URI of the processor and use the producer template to send the information to the endpoint and run the asserts on that endpoint. Is that a proper usage?
I don't really understand yet how mock endpoints work, I am seeking a simple example to help get me over this. Let's say I have a processor testProc that just does something trivial such as: public class testProc implements Processor { @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader("myHeader", "Yay"); } } let's say this processor is defined as a bean: <bean id="myProcessor" class="com.test.testProc"/> How do you use the mock and producer template to test this within a test class? How do I wire the mock endpoint to the processor uri? What do I need to do to setup the mock endpoint for this public class ProcessStatusManagerTest extends CamelTestSupport{ @EndpointInject(uri = "mock:myProcessor") protected MockEndpoint resultEndpoint; @Produce(uri = "direct:start") protected ProducerTemplate template; @Test public void procTest() throws Exception { resultEndpoint.message(0).header("myHeader").isEqualTo("Yay"); template.sendBody("Test"); resultEndpoint.assertIsSatisfied(); } } So assuming this sort of general flow is correct, I suppose my main hurdle of understanding is based on not knowing how a mock endpoint can get wired to an existing uri endpoint in the context. I saw some mention of context.resolveEndpoint(), but in the version I am using (Camel 2.8) I actually don't see a resolve endpoint on org.apache.camel.test.CamelTestSupport.context. So how do I modify this to run for the proper processor uri? -- View this message in context: http://camel.465427.n5.nabble.com/Unit-Testing-Question-tp5745966p5746089.html Sent from the Camel - Users mailing list archive at Nabble.com.