Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor copy edits

...

Include Page
CAMEL:Testing Summary Include
CAMEL:Testing Summary Include

The Test test component extends the Mock component to support pulling messages from another endpoint on startup to set the expected message bodies on the underlying Mock endpoint. i.e. That is, you use the test endpoint in a route and messages arriving on it will be implicitly compared to some expected messages extracted from some other location.

So you can use, for example, an expected set of message bodies as files. This will then setup set up a properly configured Mock endpoint, which is only valid if the received messages match the number of expected messages and their message payloads are equal.

...

Where expectedMessagesEndpointUri refers to some other Component URI where that the expected message bodies are pulled from before starting the test.

Example

For example, you could write a test case as follows:

Code Block
from("seda:someEndpoint").
  to("test:file://data/expectedOutput?noop=true");

If your test then invokes the MockEndpoint.assertIsSatisfied(camelContext) method then , your test case will perform the necessary assertions.

...