Mock ComponentThe mock: component provides a powerful declarative testing mechanism which is similar to jMock URI formatmock:someName Where someName can be any string to uniquely identify the endpoint ExamplesHere's quick example of MockEndpoint in use, asserting the number of messages which are expected during a test run MockEndpoint resultEndpoint = context.resolveEndpoint("mock:foo", MockEndpoint.class); resultEndpoint.expectedMessageCount(2); // send some messages ... // now lets assert that the mock:foo endpoint received 2 messages resultEndpoint.assertIsSatisfied(); You can see from the javadoc of MockEndpoint Here's another example resultEndpoint.expectedBodiesReceived("firstMessageBody", "secondMessageBody", "thirdMessageBody"); Or you could add an expectation on the headers or content of a specific message. For example resultEndpoint.message(0).header("foo").isEqualTo("bar"); There are some examples of the Mock endpoint in use in the camel-corecore processor tests See Also |