You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2015/06/14 09:21:15 UTC

svn commit: r954779 [2/4] - in /websites/production/camel/content: book-component-appendix.html book-cookbook.html book-in-one-page.html cache/main.pageCache mock.html

Modified: websites/production/camel/content/book-cookbook.html
==============================================================================
--- websites/production/camel/content/book-cookbook.html (original)
+++ websites/production/camel/content/book-cookbook.html Sun Jun 14 07:21:15 2015
@@ -1099,54 +1099,18 @@ return new ProcessBuilder(jpaTemplate, t
 <p>So you could query data from various Camel <a shape="rect" href="components.html">Components</a> such as <a shape="rect" href="file2.html">File</a>, <a shape="rect" href="http.html">HTTP</a> or <a shape="rect" href="jpa.html">JPA</a>, perform multiple patterns such as <a shape="rect" href="splitter.html">Splitter</a> or <a shape="rect" href="message-translator.html">Message Translator</a> then send the messages to some other <a shape="rect" href="component.html">Component</a>.</p>
 
 <p>To show how this all fits together, try the <a shape="rect" href="etl-example.html">ETL Example</a> </p>
-<h2 id="Bookcookbook-MockComponent">Mock Component</h2>
-
-<a shape="rect" href="testing.html">Testing</a> of distributed and asynchronous processing is notoriously difficult. The <a shape="rect" href="mock.html">Mock</a>, <a shape="rect" href="test.html">Test</a> and <a shape="rect" href="dataset.html">DataSet</a> endpoints work great with the <a shape="rect" href="testing.html">Camel Testing Framework</a> to simplify your unit and integration testing using <a shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a> and Camel's large range of <a shape="rect" href="components.html">Components</a> together with the powerful <a shape="rect" href="bean-integration.html">Bean Integration</a>.
-
-<p>The Mock component provides a powerful declarative testing mechanism, which is similar to <a shape="rect" class="external-link" href="http://jmock.org" rel="nofollow">jMock</a> in that it allows declarative expectations to be created on any Mock endpoint before a test begins. Then the test is run, which typically fires messages to one or more endpoints, and finally the expectations can be asserted in a test case to ensure the system  worked as expected. </p>
-
-<p>This allows you to test various things like:</p>
-<ul><li>The correct number of messages are received on each endpoint,</li><li>The correct payloads are received, in the right order,</li><li>Messages arrive on an endpoint in order, using some <a shape="rect" href="expression.html">Expression</a> to create an order testing function,</li><li>Messages arrive match some kind of <a shape="rect" href="predicate.html">Predicate</a> such as that specific headers have certain values, or that parts of the messages match some predicate, such as by evaluating an <a shape="rect" href="xpath.html">XPath</a> or <a shape="rect" href="xquery.html">XQuery</a> <a shape="rect" href="expression.html">Expression</a>.</li></ul>
-
-
-<p><strong>Note</strong> that there is also the <a shape="rect" href="test.html">Test endpoint</a> which is a Mock endpoint, but which uses a second endpoint to provide the list of expected message bodies and automatically sets up the Mock endpoint assertions. In other words, it's a Mock endpoint that automatically sets up its assertions from some sample messages in a <a shape="rect" href="file2.html">File</a> or <a shape="rect" href="jpa.html">database</a>, for example.</p>
-
-    <div class="aui-message problem shadowed information-macro">
+<h2 id="Bookcookbook-MockComponent">Mock Component</h2><p><a shape="rect" href="testing.html">Testing</a> of distributed and asynchronous processing is notoriously difficult. The <a shape="rect" href="mock.html">Mock</a>, <a shape="rect" href="test.html">Test</a> and <a shape="rect" href="dataset.html">DataSet</a> endpoints work great with the <a shape="rect" href="testing.html">Camel Testing Framework</a> to simplify your unit and integration testing using <a shape="rect" href="enterprise-integration-patterns.html">Enterprise Integration Patterns</a> and Camel's large range of <a shape="rect" href="components.html">Components</a> together with the powerful <a shape="rect" href="bean-integration.html">Bean Integration</a>.</p><p>The Mock component provides a powerful declarative testing mechanism, which is similar to <a shape="rect" class="external-link" href="http://www.jmock.org" rel="nofollow">jMock</a><a shape="rect" class="external-link" href="http://jmock.org" rel="nofollow"><
 /a> in that it allows declarative expectations to be created on any Mock endpoint before a test begins. Then the test is run, which typically fires messages to one or more endpoints, and finally the expectations can be asserted in a test case to ensure the system worked as expected.</p><p>This allows you to test various things like:</p><ul><li>The correct number of messages are received on each endpoint,</li><li>The correct payloads are received, in the right order,</li><li>Messages arrive on an endpoint in order, using some <a shape="rect" href="expression.html">Expression</a> to create an order testing function,</li><li>Messages arrive match some kind of <a shape="rect" href="predicate.html">Predicate</a> such as that specific headers have certain values, or that parts of the messages match some predicate, such as by evaluating an <a shape="rect" href="xpath.html">XPath</a> or <a shape="rect" href="xquery.html">XQuery</a> <a shape="rect" href="expression.html">Expression</a>.</li>
 </ul><p><strong>Note</strong> that there is also the <a shape="rect" href="test.html">Test endpoint</a> which is a Mock endpoint, but which uses a second endpoint to provide the list of expected message bodies and automatically sets up the Mock endpoint assertions. In other words, it's a Mock endpoint that automatically sets up its assertions from some sample messages in a <a shape="rect" href="file2.html">File</a> or <a shape="rect" href="jpa.html">database</a>, for example.</p>    <div class="aui-message problem shadowed information-macro">
                     <p class="title">Mock endpoints keep received Exchanges in memory indefinitely</p>
                             <span class="aui-icon icon-problem">Icon</span>
                 <div class="message-content">
-                            
-<p>Remember that Mock is designed for testing.  When you add Mock endpoints to a route, each <a shape="rect" href="exchange.html">Exchange</a> sent to the endpoint will be stored (to allow for later validation) in memory until explicitly reset or the JVM is restarted.  If you are sending high volume and/or large messages, this may cause excessive memory use.  If your goal is to test deployable routes inline, consider using <a shape="rect" href="notifybuilder.html">NotifyBuilder</a> or <a shape="rect" href="advicewith.html">AdviceWith</a> in your tests instead of adding Mock endpoints to routes directly.</p>
-
-<p>From Camel 2.10 onwards there are two new options <code>retainFirst</code>, and <code>retainLast</code> that can be used to limit the number of messages the Mock endpoints keep in memory.</p>
+                            <p>Remember that Mock is designed for testing. When you add Mock endpoints to a route, each <a shape="rect" href="exchange.html">Exchange</a> sent to the endpoint will be stored (to allow for later validation) in memory until explicitly reset or the JVM is restarted. If you are sending high volume and/or large messages, this may cause excessive memory use. If your goal is to test deployable routes inline, consider using <a shape="rect" href="notifybuilder.html">NotifyBuilder</a> or <a shape="rect" href="advicewith.html">AdviceWith</a> in your tests instead of adding Mock endpoints to routes directly.</p><p>From Camel 2.10 onwards there are two new options <code>retainFirst</code>, and <code>retainLast</code> that can be used to limit the number of messages the Mock endpoints keep in memory.</p>
                     </div>
     </div>
- 
-
-<h3 id="Bookcookbook-URIformat">URI format</h3>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mock:someName[?options]
+<h3 id="Bookcookbook-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mock:someName[?options]
 ]]></script>
-</div></div>
-
-<p>Where <strong>someName</strong> can be any string that uniquely identifies the endpoint.</p>
-
-<p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p>
-
-<h3 id="Bookcookbook-Options">Options</h3>
-<div class="confluenceTableSmall">
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Option </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>reportGroup</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> A size to use a <a shape="rect" href="log.html">throughput logger</a> for reporting </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>retainFirst</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.10:</strong> To only keep first X number of messages in memory. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>retainLast</code> </p><
 /td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.10:</strong> To only keep last X number of messages in memory. </p></td></tr></tbody></table></div>
-</div>
-
-<h3 id="Bookcookbook-SimpleExample.1">Simple Example</h3>
-
-<p>Here's a simple example of Mock endpoint in use. First, the endpoint is resolved on the context. Then we set an expectation, and then, after the test has run, we assert that our expectations have been met.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-MockEndpoint resultEndpoint = context.resolveEndpoint(&quot;mock:foo&quot;, MockEndpoint.class);
+</div></div><p>Where <strong>someName</strong> can be any string that uniquely identifies the endpoint.</p><p>You can append query options to the URI in the following format, <code>?option=value&amp;option=value&amp;...</code></p><h3 id="Bookcookbook-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reportGroup</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>A size to use a <a shape="rect" href="log.html">throughput logger</a> for reporting</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>retainFirst</code></p></td><td cols
 pan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> To only keep first X number of messages in memory.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>retainLast</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> To only keep last X number of messages in memory.</p></td></tr></tbody></table></div></div><h3 id="Bookcookbook-SimpleExample.1">Simple Example</h3><p>Here's a simple example of Mock endpoint in use. First, the endpoint is resolved on the context. Then we set an expectation, and then, after the test has run, we assert that our expectations have been met.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[MockEndpoint resultEndpoint = context.resolveEndpoint(&quot;mock:foo&quot;, MockEndpoint.class);
 
 resultEndpoint.expectedMessageCount(2);
 
@@ -1156,18 +1120,8 @@ resultEndpoint.expectedMessageCount(2);
 // now lets assert that the mock:foo endpoint received 2 messages
 resultEndpoint.assertIsSatisfied();
 ]]></script>
-</div></div>
-
-<p>You typically always call the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#assertIsSatisfied()">assertIsSatisfied() method</a> to test that the expectations were met after running a test.</p>
-
-<p>Camel will by default wait 10 seconds when the <code>assertIsSatisfied()</code> is invoked. This can be configured by setting the <code>setResultWaitTime(millis)</code> method.</p>
-
-<h4 id="Bookcookbook-UsingassertPeriod">Using assertPeriod</h4>
-<p><strong>Available as of Camel 2.7</strong><br clear="none">
-When the assertion is satisfied then Camel will stop waiting and continue from the <code>assertIsSatisfied</code> method. That means if a new message arrives on the mock endpoint, just a bit later, that arrival will not affect the outcome of the assertion. Suppose you do want to test that no new messages arrives after a period thereafter, then you can do that by setting the <code>setAssertPeriod</code> method, for example:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-MockEndpoint resultEndpoint = context.resolveEndpoint(&quot;mock:foo&quot;, MockEndpoint.class);
+</div></div><p>You typically always call the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#assertIsSatisfied()">assertIsSatisfied() method</a> to test that the expectations were met after running a test.</p><p>Camel will by default wait 10 seconds when the <code>assertIsSatisfied()</code> is invoked. This can be configured by setting the <code>setResultWaitTime(millis)</code> method.</p><h4 id="Bookcookbook-UsingassertPeriod">Using assertPeriod</h4><p><strong>Available as of Camel 2.7</strong><br clear="none"> When the assertion is satisfied then Camel will stop waiting and continue from the <code>assertIsSatisfied</code> method. That means if a new message arrives on the mock endpoint, just a bit later, that arrival will not affect the outcome of the assertion. Suppose you do want to test that no new messages arrives after a period thereafter, then you can do that by setting the
  <code>setAssertPeriod</code> method, for example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[MockEndpoint resultEndpoint = context.resolveEndpoint(&quot;mock:foo&quot;, MockEndpoint.class);
 resultEndpoint.setAssertPeriod(5000);
 resultEndpoint.expectedMessageCount(2);
 
@@ -1177,54 +1131,20 @@ resultEndpoint.expectedMessageCount(2);
 // now lets assert that the mock:foo endpoint received 2 messages
 resultEndpoint.assertIsSatisfied();
 ]]></script>
-</div></div>
-
-<h3 id="Bookcookbook-Settingexpectations">Setting expectations</h3>
-
-<p>You can see from the javadoc of <a shape="rect" href="httphttp://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html" rel="nofollow">MockEndpoint</a> the various helper methods you can use to set expectations. The main methods are as follows: </p>
-<div class="confluenceTableSmall">
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Method </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedMessageCount(int)">expectedMessageCount(int)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To define the expected message count on the endpoint. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedMinimumMessageCount(int)">expectedMinimumMessageCount(int)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To define the minimum number of expected messag
 es on the endpoint. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedBodiesReceived(java.lang.Object...)">expectedBodiesReceived(...)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To define the expected bodies that should be received (in order). </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedHeaderReceived(java.lang.String,%20java.lang.String)">expectedHeaderReceived(...)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To define the expected header that should be received </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="htt
 p://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectsAscending(org.apache.camel.Expression)">expectsAscending(Expression)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To add an expectation that messages are received in order, using the given <a shape="rect" href="expression.html">Expression</a> to compare messages. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectsDescending(org.apache.camel.Expression)">expectsDescending(Expression)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To add an expectation that messages are received in order, using the given <a shape="rect" href="expression.html">Expression</a> to compare messages. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect
 " class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectsNoDuplicates(org.apache.camel.Expression)">expectsNoDuplicates(Expression)</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> To add an expectation that no duplicate messages are received; using an <a shape="rect" href="expression.html">Expression</a> to calculate a unique identifier for each message. This could be something like the <code>JMSMessageID</code> if using JMS, or some unique reference number within the message. </p></td></tr></tbody></table></div>
-</div>
-
-<p>Here's another example:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-resultEndpoint.expectedBodiesReceived(&quot;firstMessageBody&quot;, &quot;secondMessageBody&quot;, &quot;thirdMessageBody&quot;);
+</div></div><h3 id="Bookcookbook-Settingexpectations">Setting expectations</h3><p>You can see from the javadoc of <a shape="rect" href="httphttp://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html" rel="nofollow">MockEndpoint</a> the various helper methods you can use to set expectations. The main methods are as follows:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Method</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedMessageCount(int)">expectedMessageCount(int)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To define the expected message count on the endpoint.
 </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedMinimumMessageCount(int)">expectedMinimumMessageCount(int)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To define the minimum number of expected messages on the endpoint.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedBodiesReceived(java.lang.Object...)">expectedBodiesReceived(...)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To define the expected bodies that should be received (in order).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/came
 l-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectedHeaderReceived(java.lang.String,%20java.lang.String)">expectedHeaderReceived(...)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To define the expected header that should be received</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectsAscending(org.apache.camel.Expression)">expectsAscending(Expression)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To add an expectation that messages are received in order, using the given <a shape="rect" href="expression.html">Expression</a> to compare messages.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint
 .html#expectsDescending(org.apache.camel.Expression)">expectsDescending(Expression)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To add an expectation that messages are received in order, using the given <a shape="rect" href="expression.html">Expression</a> to compare messages.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#expectsNoDuplicates(org.apache.camel.Expression)">expectsNoDuplicates(Expression)</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To add an expectation that no duplicate messages are received; using an <a shape="rect" href="expression.html">Expression</a> to calculate a unique identifier for each message. This could be something like the <code>JMSMessageID</code> if using JMS, or some unique reference number within the message.</p></td></tr></tbody></table></
 div></div><p>Here's another example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[resultEndpoint.expectedBodiesReceived(&quot;firstMessageBody&quot;, &quot;secondMessageBody&quot;, &quot;thirdMessageBody&quot;);
 ]]></script>
-</div></div>
-
-<h4 id="Bookcookbook-Addingexpectationstospecificmessages">Adding expectations to specific messages</h4>
-
-<p>In addition, you can use the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#message(int)">message(int messageIndex)</a> method to add assertions about a specific message that is received.</p>
-
-<p>For example, to add expectations of the headers or body of the first message (using zero-based indexing like <code>java.util.List</code>), you can use the following code:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-resultEndpoint.message(0).header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;);
+</div></div><h4 id="Bookcookbook-Addingexpectationstospecificmessages">Adding expectations to specific messages</h4><p>In addition, you can use the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#message(int)">message(int messageIndex)</a> method to add assertions about a specific message that is received.</p><p>For example, to add expectations of the headers or body of the first message (using zero-based indexing like <code>java.util.List</code>), you can use the following code:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[resultEndpoint.message(0).header(&quot;foo&quot;).isEqualTo(&quot;bar&quot;);
 ]]></script>
-</div></div>
-
-<p>There are some examples of the Mock endpoint in use in the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/">camel-core processor tests</a>.</p>
-
-
-<h3 id="Bookcookbook-Mockingexistingendpoints">Mocking existing endpoints</h3>
-<p><strong>Available as of Camel 2.7</strong></p>
-
-<p>Camel now allows you to automatically mock existing endpoints in your Camel routes.</p>
-    <div class="aui-message hint shadowed information-macro">
+</div></div><p>There are some examples of the Mock endpoint in use in the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/">camel-core processor tests</a>.</p><h3 id="Bookcookbook-Mockingexistingendpoints">Mocking existing endpoints</h3><p><strong>Available as of Camel 2.7</strong></p><p>Camel now allows you to automatically mock existing endpoints in your Camel routes.</p>    <div class="aui-message hint shadowed information-macro">
                     <p class="title">How it works</p>
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p><strong>Important:</strong> The endpoints are still in action.  What happens differently is that a <a shape="rect" href="mock.html">Mock</a> endpoint is injected and receives the message first and then delegates the message to the target endpoint. You can view this as a kind of intercept and delegate or endpoint listener.</p>
+                            <p><strong>Important:</strong> The endpoints are still in action. What happens differently is that a <a shape="rect" href="mock.html">Mock</a> endpoint is injected and receives the message first and then delegates the message to the target endpoint. You can view this as a kind of intercept and delegate or endpoint listener.</p>
                     </div>
     </div>
-
-
-<p>Suppose you have the given route below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div class="codeContent panelContent pdl">
+<p>Suppose you have the given route below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Route</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {
@@ -1238,10 +1158,7 @@ protected RouteBuilder createRouteBuilde
     };
 }
 ]]></script>
-</div></div>
-
-<p>You can then use the <code>adviceWith</code> feature in Camel to mock all the endpoints in a given route from your unit test, as shown below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mocking all endpoints</b></div><div class="codeContent panelContent pdl">
+</div></div><p>You can then use the <code>adviceWith</code> feature in Camel to mock all the endpoints in a given route from your unit test, as shown below:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mocking all endpoints</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 public void testAdvisedMockEndpoints() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
@@ -1274,27 +1191,17 @@ public void testAdvisedMockEndpoints() t
     assertNotNull(context.hasEndpoint(&quot;mock:log:foo&quot;));
 }
 ]]></script>
-</div></div>
-
-<p>Notice that the mock endpoints is given the uri <code>mock:&lt;endpoint&gt;</code>, for example <code>mock:direct:foo</code>. Camel logs at <code>INFO</code> level the endpoints being mocked:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-INFO  Adviced endpoint [direct://foo] with mock endpoint [mock:direct:foo]
+</div></div><p>Notice that the mock endpoints is given the uri <code>mock:&lt;endpoint&gt;</code>, for example <code>mock:direct:foo</code>. Camel logs at <code>INFO</code> level the endpoints being mocked:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[INFO  Adviced endpoint [direct://foo] with mock endpoint [mock:direct:foo]
 ]]></script>
-</div></div>
-
-    <div class="aui-message hint shadowed information-macro">
+</div></div>    <div class="aui-message hint shadowed information-macro">
                     <p class="title">Mocked endpoints are without parameters</p>
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p>Endpoints which are mocked will have their parameters stripped off. For example the endpoint "log:foo?showAll=true" will be mocked to the following endpoint "mock:log:foo". Notice the parameters have been removed.</p>
+                            <p>Endpoints which are mocked will have their parameters stripped off. For example the endpoint "log:foo?showAll=true" will be mocked to the following endpoint "mock:log:foo". Notice the parameters have been removed.</p>
                     </div>
     </div>
-
-
-<p>Its also possible to only mock certain endpoints using a pattern. For example to mock all <code>log</code> endpoints you do as shown:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mocking only log endpoints using a pattern</b></div><div class="codeContent panelContent pdl">
+<p>Its also possible to only mock certain endpoints using a pattern. For example to mock all <code>log</code> endpoints you do as shown:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mocking only log endpoints using a pattern</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 public void testAdvisedMockEndpointsWithPattern() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
@@ -1327,26 +1234,13 @@ public void testAdvisedMockEndpointsWith
     assertNull(context.hasEndpoint(&quot;mock:direct:foo&quot;));
 }
 ]]></script>
-</div></div>
-
-<p>The pattern supported can be a wildcard or a regular expression. See more details about this at <a shape="rect" href="intercept.html">Intercept</a> as its the same matching function used by Camel. </p>
-
-    <div class="aui-message hint shadowed information-macro">
+</div></div><p>The pattern supported can be a wildcard or a regular expression. See more details about this at <a shape="rect" href="intercept.html">Intercept</a> as its the same matching function used by Camel.</p>    <div class="aui-message hint shadowed information-macro">
                             <span class="aui-icon icon-hint">Icon</span>
                 <div class="message-content">
-                            
-<p>Mind that mocking endpoints causes the messages to be copied when they arrive on the mock.<br clear="none">
-That means Camel will use more memory. This may not be suitable when you send in a lot of messages.</p>
+                            <p>Mind that mocking endpoints causes the messages to be copied when they arrive on the mock.<br clear="none"> That means Camel will use more memory. This may not be suitable when you send in a lot of messages.</p>
                     </div>
     </div>
-
-
-<h4 id="Bookcookbook-Mockingexistingendpointsusingthecamel-testcomponent">Mocking existing endpoints using the <code>camel-test</code> component</h4>
-
-<p>Instead of using the <code>adviceWith</code> to instruct Camel to mock endpoints, you can easily enable this behavior when using the <code>camel-test</code> Test Kit.<br clear="none">
-The same route can be tested as follows. Notice that we return <code>"*"</code> from the <code>isMockEndpoints</code> method, which tells Camel to mock all endpoints.<br clear="none">
-If you only want to mock all <code>log</code> endpoints you can return <code>"log*"</code> instead. </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpoints using camel-test kit</b></div><div class="codeContent panelContent pdl">
+<h4 id="Bookcookbook-Mockingexistingendpointsusingthecamel-testcomponent">Mocking existing endpoints using the <code>camel-test</code> component</h4><p>Instead of using the <code>adviceWith</code> to instruct Camel to mock endpoints, you can easily enable this behavior when using the <code>camel-test</code> Test Kit.<br clear="none"> The same route can be tested as follows. Notice that we return <code>"*"</code> from the <code>isMockEndpoints</code> method, which tells Camel to mock all endpoints.<br clear="none"> If you only want to mock all <code>log</code> endpoints you can return <code>"log*"</code> instead.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpoints using camel-test kit</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 public class IsMockEndpointsJUnit4Test extends CamelTestSupport {
 
@@ -1393,15 +1287,7 @@ public class IsMockEndpointsJUnit4Test e
     }
 }
 ]]></script>
-</div></div>
-
-<h4 id="Bookcookbook-MockingexistingendpointswithXMLDSL">Mocking existing endpoints with XML DSL</h4>
-
-<p>If you do not use the <code>camel-test</code> component for unit testing (as shown above) you can use a different approach when using XML files for routes.<br clear="none">
-The solution is to create a new XML file used by the unit test and then include the intended XML file which has the route you want to test.</p>
-
-<p>Suppose we have the route in the <code>camel-route.xml</code> file:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>camel-route.xml</b></div><div class="codeContent panelContent pdl">
+</div></div><h4 id="Bookcookbook-MockingexistingendpointswithXMLDSL">Mocking existing endpoints with XML DSL</h4><p>If you do not use the <code>camel-test</code> component for unit testing (as shown above) you can use a different approach when using XML files for routes.<br clear="none"> The solution is to create a new XML file used by the unit test and then include the intended XML file which has the route you want to test.</p><p>Suppose we have the route in the <code>camel-route.xml</code> file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>camel-route.xml</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 &lt;!-- this camel route is in the camel-route.xml file --&gt;
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
@@ -1422,10 +1308,7 @@ The solution is to create a new XML file
 
 &lt;/camelContext&gt;
 ]]></script>
-</div></div>
-
-<p>Then we create a new XML file as follows, where we include the <code>camel-route.xml</code> file and define a spring bean with the class <code>org.apache.camel.impl.InterceptSendToMockEndpointStrategy</code> which tells Camel to mock all endpoints:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>test-camel-route.xml</b></div><div class="codeContent panelContent pdl">
+</div></div><p>Then we create a new XML file as follows, where we include the <code>camel-route.xml</code> file and define a spring bean with the class <code>org.apache.camel.impl.InterceptSendToMockEndpointStrategy</code> which tells Camel to mock all endpoints:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>test-camel-route.xml</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
 &lt;!-- the Camel route is defined in another XML file --&gt;
 &lt;import resource=&quot;camel-route.xml&quot;/&gt;
@@ -1433,25 +1316,12 @@ The solution is to create a new XML file
 &lt;!-- bean which enables mocking all endpoints --&gt;
 &lt;bean id=&quot;mockAllEndpoints&quot; class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;/&gt;
 ]]></script>
-</div></div>
-
-<p>Then in your unit test you load the new XML file (<code>test-camel-route.xml</code>) instead of <code>camel-route.xml</code>.</p>
-
-<p>To only mock all <a shape="rect" href="log.html">log</a> endpoints you can define the pattern in the constructor for the bean:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;bean id=&quot;mockAllEndpoints&quot; class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;&gt;
+</div></div><p>Then in your unit test you load the new XML file (<code>test-camel-route.xml</code>) instead of <code>camel-route.xml</code>.</p><p>To only mock all <a shape="rect" href="log.html">Log</a> endpoints you can define the pattern in the constructor for the bean:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;bean id=&quot;mockAllEndpoints&quot; class=&quot;org.apache.camel.impl.InterceptSendToMockEndpointStrategy&quot;&gt;
     &lt;constructor-arg index=&quot;0&quot; value=&quot;log*&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div>
-
-<h4 id="Bookcookbook-Mockingendpointsandskipsendingtooriginalendpoint">Mocking endpoints and skip sending to original endpoint</h4>
-<p><strong>Available as of Camel 2.10</strong></p>
-
-<p>Sometimes you want to easily mock and skip sending to a certain endpoints. So the message is detoured and send to the mock endpoint only. From Camel 2.10 onwards you can now use the <code>mockEndpointsAndSkip</code> method using <a shape="rect" href="advicewith.html">AdviceWith</a> or the <a shape="rect" class="unresolved" href="#">Test Kit</a>. The example below will skip sending to the two endpoints <code>"direct:foo"</code>, and <code>"direct:bar"</code>.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mock and skip sending to endpoints</b></div><div class="codeContent panelContent pdl">
+</div></div><h4 id="Bookcookbook-Mockingendpointsandskipsendingtooriginalendpoint">Mocking endpoints and skip sending to original endpoint</h4><p><strong>Available as of Camel 2.10</strong></p><p>Sometimes you want to easily mock and skip sending to a certain endpoints. So the message is detoured and send to the mock endpoint only. From Camel 2.10 onwards you can now use the <code>mockEndpointsAndSkip</code> method using <a shape="rect" href="advicewith.html">AdviceWith</a> or the <a shape="rect" class="unresolved" href="#">Test Kit</a>. The example below will skip sending to the two endpoints <code>"direct:foo"</code>, and <code>"direct:bar"</code>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>adviceWith mock and skip sending to endpoints</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 public void testAdvisedMockEndpointsWithSkip() throws Exception {
     // advice the first route using the inlined AdviceWith route builder
@@ -1477,10 +1347,7 @@ public void testAdvisedMockEndpointsWith
     assertEquals(0, seda.getCurrentQueueSize());
 }
 ]]></script>
-</div></div>
-
-<p>The same example using the <a shape="rect" href="testing.html">Test Kit</a></p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpointsAndSkip using camel-test kit</b></div><div class="codeContent panelContent pdl">
+</div></div><p>The same example using the <a shape="rect" href="testing.html">Test Kit</a></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>isMockEndpointsAndSkip using camel-test kit</b></div><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 public class IsMockEndpointsAndSkipJUnit4Test extends CamelTestSupport {
 
@@ -1519,18 +1386,8 @@ public class IsMockEndpointsAndSkipJUnit
     }
 }
 ]]></script>
-</div></div>
-
-<h3 id="Bookcookbook-Limitingthenumberofmessagestokeep">Limiting the number of messages to keep</h3>
-<p><strong>Available as of Camel 2.10</strong></p>
-
-<p>The <a shape="rect" href="mock.html">Mock</a> endpoints will by default keep a copy of every <a shape="rect" href="exchange.html">Exchange</a> that it received. So if you test with a lot of messages, then it will consume memory.<br clear="none">
-From Camel 2.10 onwards we have introduced two options <code>retainFirst</code> and <code>retainLast</code> that can be used to specify to only keep N'th of the first and/or last <a shape="rect" href="exchange.html">Exchange</a>s.</p>
-
-<p>For example in the code below, we only want to retain a copy of the first 5 and last 5 <a shape="rect" href="exchange.html">Exchange</a>s the mock receives.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  MockEndpoint mock = getMockEndpoint(&quot;mock:data&quot;);
+</div></div><h3 id="Bookcookbook-Limitingthenumberofmessagestokeep">Limiting the number of messages to keep</h3><p><strong>Available as of Camel 2.10</strong></p><p>The <a shape="rect" href="mock.html">Mock</a> endpoints will by default keep a copy of every <a shape="rect" href="exchange.html">Exchange</a> that it received. So if you test with a lot of messages, then it will consume memory.<br clear="none"> From Camel 2.10 onwards we have introduced two options <code>retainFirst</code> and <code>retainLast</code> that can be used to specify to only keep N'th of the first and/or last <a shape="rect" href="exchange.html">Exchange</a>s.</p><p>For example in the code below, we only want to retain a copy of the first 5 and last 5 <a shape="rect" href="exchange.html">Exchange</a>s the mock receives.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  MockEndpoint mock = getMockEndpoint(&quot;mock:data&quot;);
   mock.setRetainFirst(5);
   mock.setRetainLast(5);
   mock.expectedMessageCount(2000);
@@ -1539,66 +1396,30 @@ From Camel 2.10 onwards we have introduc
 
   mock.assertIsSatisfied();
 ]]></script>
-</div></div>
-
-<p>Using this has some limitations. The <code>getExchanges()</code> and <code>getReceivedExchanges()</code> methods on the <code>MockEndpoint</code> will return only the retained copies of the <a shape="rect" href="exchange.html">Exchange</a>s. So in the example above, the list will contain 10 <a shape="rect" href="exchange.html">Exchange</a>s; the first five, and the last five.<br clear="none">
-The <code>retainFirst</code> and <code>retainLast</code> options also have limitations on which expectation methods you can use. For example the expectedXXX methods that work on message bodies, headers, etc. will only operate on the retained messages. In the example above they can test only the expectations on the 10 retained messages.</p>
-
-
-<h3 id="Bookcookbook-Testingwitharrivaltimes">Testing with arrival times</h3>
-<p><strong>Available as of Camel 2.7</strong></p>
-
-<p>The <a shape="rect" href="mock.html">Mock</a> endpoint stores the arrival time of the message as a property on the <a shape="rect" href="exchange.html">Exchange</a>.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-Date time = exchange.getProperty(Exchange.RECEIVED_TIMESTAMP, Date.class);
+</div></div><p>Using this has some limitations. The <code>getExchanges()</code> and <code>getReceivedExchanges()</code> methods on the <code>MockEndpoint</code> will return only the retained copies of the <a shape="rect" href="exchange.html">Exchange</a>s. So in the example above, the list will contain 10 <a shape="rect" href="exchange.html">Exchange</a>s; the first five, and the last five.<br clear="none"> The <code>retainFirst</code> and <code>retainLast</code> options also have limitations on which expectation methods you can use. For example the expectedXXX methods that work on message bodies, headers, etc. will only operate on the retained messages. In the example above they can test only the expectations on the 10 retained messages.</p><h3 id="Bookcookbook-Testingwitharrivaltimes">Testing with arrival times</h3><p><strong>Available as of Camel 2.7</strong></p><p>The <a shape="rect" href="mock.html">Mock</a> endpoint stores the arrival time of the message as a property on the <
 a shape="rect" href="exchange.html">Exchange</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[Date time = exchange.getProperty(Exchange.RECEIVED_TIMESTAMP, Date.class);
 ]]></script>
-</div></div>
-
-<p>You can use this information to know when the message arrived on the mock. But it also provides foundation to know the time interval between the previous and next message arrived on the mock. You can use this to set expectations using the <code>arrives</code> DSL on the <a shape="rect" href="mock.html">Mock</a> endpoint.</p>
-
-<p>For example to say that the first message should arrive between 0-2 seconds before the next you can do:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mock.message(0).arrives().noLaterThan(2).seconds().beforeNext();
+</div></div><p>You can use this information to know when the message arrived on the mock. But it also provides foundation to know the time interval between the previous and next message arrived on the mock. You can use this to set expectations using the <code>arrives</code> DSL on the <a shape="rect" href="mock.html">Mock</a> endpoint.</p><p>For example to say that the first message should arrive between 0-2 seconds before the next you can do:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mock.message(0).arrives().noLaterThan(2).seconds().beforeNext();
 ]]></script>
-</div></div>
-
-<p>You can also define this as that 2nd message (0 index based) should arrive no later than 0-2 seconds after the previous:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mock.message(1).arrives().noLaterThan(2).seconds().afterPrevious();
+</div></div><p>You can also define this as that 2nd message (0 index based) should arrive no later than 0-2 seconds after the previous:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mock.message(1).arrives().noLaterThan(2).seconds().afterPrevious();
 ]]></script>
-</div></div>
-
-<p>You can also use between to set a lower bound. For example suppose that it should be between 1-4 seconds:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mock.message(1).arrives().between(1, 4).seconds().afterPrevious();
+</div></div><p>You can also use between to set a lower bound. For example suppose that it should be between 1-4 seconds:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mock.message(1).arrives().between(1, 4).seconds().afterPrevious();
 ]]></script>
-</div></div>
-
-<p>You can also set the expectation on all messages, for example to say that the gap between them should be at most 1 second:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mock.allMessages().arrives().noLaterThan(1).seconds().beforeNext();
+</div></div><p>You can also set the expectation on all messages, for example to say that the gap between them should be at most 1 second:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mock.allMessages().arrives().noLaterThan(1).seconds().beforeNext();
 ]]></script>
-</div></div>
-
-    <div class="aui-message success shadowed information-macro">
+</div></div>    <div class="aui-message success shadowed information-macro">
                     <p class="title">time units</p>
                             <span class="aui-icon icon-success">Icon</span>
                 <div class="message-content">
-                            
-<p>In the example above we use <code>seconds</code> as the time unit, but Camel offers <code>milliseconds</code>, and <code>minutes</code> as well.</p>
+                            <p>In the example above we use <code>seconds</code> as the time unit, but Camel offers <code>milliseconds</code>, and <code>minutes</code> as well.</p>
                     </div>
     </div>
-
-
-
-<h3 id="Bookcookbook-SeeAlso">See Also</h3>
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul>
-<ul><li><a shape="rect" href="spring-testing.html">Spring Testing</a></li><li><a shape="rect" href="testing.html">Testing</a></li></ul>
+<p></p><h3 id="Bookcookbook-SeeAlso">See Also</h3>
+<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul><ul><li><a shape="rect" href="spring-testing.html">Spring Testing</a></li><li><a shape="rect" href="testing.html">Testing</a></li></ul>
 <h2 id="Bookcookbook-Testing">Testing</h2>
 
 <p>Testing is a crucial activity in any piece of software development or integration. Typically Camel Riders use various different <a shape="rect" href="components.html">technologies</a> wired together in a variety of <a shape="rect" href="enterprise-integration-patterns.html">patterns</a> with different <a shape="rect" href="languages.html">expression languages</a> together with different forms of <a shape="rect" href="bean-integration.html">Bean Integration</a> and <a shape="rect" href="dependency-injection.html">Dependency Injection</a> so its very easy for things to go wrong! <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)"> . Testing is the crucial weapon to ensure that things work as you would expect.</p>