Using mock endpoints to verify routing logic
The ability to verify message flow using mock endpoints was built into the Camel framework from its inception. The Mock Component in the camel-core
library provides you with a testing DSL that allows you to verify which messages have reached various named mock:
endpoints defined in your route. This recipe will describe how to make use of this mock DSL.
Getting ready
To use this recipe you should first have a route test set up as described in the Testing routes defined in Java recipe.
The Java code for this recipe is located in the org.camelcookbook.examples.testing.mockreply
package.
How to do it...
To use mock endpoints, perform the following steps:
- Within your route, use a
mock:
endpoint URI in any Camel ...
Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.