Repository: camel Updated Branches: refs/heads/master 47d169ae7 -> 595599745
Added to mock javadoc about the situation for expect no messages Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/59559974 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/59559974 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/59559974 Branch: refs/heads/master Commit: 595599745b0a5a306a36b4d40a1c0b4a5e3a0205 Parents: 47d169a Author: Claus Ibsen <[email protected]> Authored: Fri Sep 12 11:00:31 2014 +0200 Committer: Claus Ibsen <[email protected]> Committed: Fri Sep 12 11:00:51 2014 +0200 ---------------------------------------------------------------------- .../apache/camel/component/mock/MockEndpoint.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/59559974/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java index 804159b..03d20a2 100644 --- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java @@ -74,6 +74,15 @@ import org.slf4j.LoggerFactory; * set expectations before the test is being started (eg before the mock receives messages). * The latter is used after the test has been executed, to verify the expectations; or * other assertions which you can perform after the test has been completed. + * <p/> + * <b>Beware:</b> If you want to expect a mock does not receive any messages, by calling + * {@link #setExpectedMessageCount(int)} with <tt>0</tt>, then take extra care, + * as <tt>0</tt> matches when the tests starts, so you need to set a assert period time + * to let the test run for a while to make sure there are still no messages arrived; for + * that use {@link #setAssertPeriod(long)}. + * An alternative is to use <a href="http://camel.apache.org/notifybuilder.html">NotifyBuilder</a>, and use the notifier + * to know when Camel is done routing some messages, before you call the {@link #assertIsSatisfied()} method on the mocks. + * This allows you to not use a fixed assert period, to speedup testing times. * * @version */ @@ -1031,6 +1040,14 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { * Specifies the expected number of message exchanges that should be * received by this endpoint. * <p/> + * <b>Beware:</b> If you want to expect that <tt>0</tt> messages, then take extra care, + * as <tt>0</tt> matches when the tests starts, so you need to set a assert period time + * to let the test run for a while to make sure there are still no messages arrived; for + * that use {@link #setAssertPeriod(long)}. + * An alternative is to use <a href="http://camel.apache.org/notifybuilder.html">NotifyBuilder</a>, and use the notifier + * to know when Camel is done routing some messages, before you call the {@link #assertIsSatisfied()} method on the mocks. + * This allows you to not use a fixed assert period, to speedup testing times. + * <p/> * If you want to assert that <b>exactly</b> n'th message arrives to this mock * endpoint, then see also the {@link #setAssertPeriod(long)} method for further details. *
