concept test in category camel

This is an excerpt from Manning's book Camel in Action.
Here, in a single Java statement, you define a route that consumes files from a file endpoint. Messages are then routed to the filter EIP, which will use an XPath predicate to test whether the message is not a test order. If a message passes the test, it’s forwarded to the JMS endpoint. Messages failing the filter test are dropped.
When you run this example, it should output the result of the test as shown here:
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
Figure 9.4 Three steps for testing: set expectations, run the test, and verify the result
![]()
Before the test is started, you set the expectations of what should happen ❶. Then you run the test ❷. Finally, you verify the outcome of the test against the expectations ❸. The Camel mock component allows you to easily implement these steps when testing Camel applications. On the mock endpoints, you can set expectations that are used to verify the test results when the test completes.