Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here's quick example of MockEndpoint in use, asserting the number of messages which are expected during a test run

Code Block
MockEndpoint resultEndpoint = context.resolveEndpoint("mock:foo");

resultEndpoint.expectedMessageCount(12);

// send some messages
...

// now lets assert that the mock:foo endpoint received a message
resultEndpoint.assertIsSatisfied();

You can see from the javadoc of MockEndpoint the various helper methods you can use. You can use other methods such as

Code Block

resultEndpoint.expectedBodiesReceived("firstMessageBody", "secondMessageBody", "thirdMessageBody");

There are some examples of the Mock endpoint in use in the camel-corecore processor tests.