Repository: camel Updated Branches: refs/heads/master 22cf585a4 -> 4118be401
Add a bit more javadoc about mock and the message count vs expected bodies override each other. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4118be40 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4118be40 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4118be40 Branch: refs/heads/master Commit: 4118be40102904b1e393fc68ca739ad68696417d Parents: 22cf585 Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Apr 23 16:39:47 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Apr 23 16:39:47 2015 +0200 ---------------------------------------------------------------------- .../camel/component/mock/MockEndpoint.java | 41 +++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4118be40/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 1f7ede6..c6732f1 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 @@ -85,6 +85,10 @@ import org.slf4j.LoggerFactory; * 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/> + * <b>Important:</b> If using {@link #expectedMessageCount(int)} and also {@link #expectedBodiesReceived(java.util.List)} or + * {@link #expectedHeaderReceived(String, Object)} then the latter overrides the number of expected message based on the + * number of values provided in the bodies/headers. * * @version */ @@ -507,6 +511,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { * <p/> * You can set multiple expectations for different header names. * If you set a value of <tt>null</tt> that means we accept either the header is absent, or its value is <tt>null</tt> + * <p/> + * <b>Important:</b> The number of values must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 values. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedHeaderReceived(final String name, final Object value) { if (expectedHeaderValues == null) { @@ -541,7 +550,12 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Adds an expectation that the given header values are received by this - * endpoint in any order + * endpoint in any order. + * <p/> + * <b>Important:</b> The number of values must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 values. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedHeaderValuesReceivedInAnyOrder(final String name, final List<?> values) { expectedMessageCount(values.size()); @@ -572,6 +586,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Adds an expectation that the given header values are received by this * endpoint in any order + * <p/> + * <b>Important:</b> The number of values must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 values. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedHeaderValuesReceivedInAnyOrder(String name, Object... values) { List<Object> valueList = new ArrayList<Object>(); @@ -622,6 +641,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Adds an expectation that the given body values are received by this * endpoint in the specified order + * <p/> + * <b>Important:</b> The number of values must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 values. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedBodiesReceived(final List<?> bodies) { expectedMessageCount(bodies.size()); @@ -684,6 +708,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Sets an expectation that the given body values are received by this endpoint + * <p/> + * <b>Important:</b> The number of bodies must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 bodies. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedBodiesReceived(Object... bodies) { List<Object> bodyList = new ArrayList<Object>(); @@ -715,6 +744,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Adds an expectation that the given body values are received by this * endpoint in any order + * <p/> + * <b>Important:</b> The number of bodies must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 bodies. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedBodiesReceivedInAnyOrder(final List<?> bodies) { expectedMessageCount(bodies.size()); @@ -738,6 +772,11 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint { /** * Adds an expectation that the given body values are received by this * endpoint in any order + * <p/> + * <b>Important:</b> The number of bodies must match the expected number of messages, so if you expect 3 messages, then + * there must be 3 bodies. + * <p/> + * <b>Important:</b> This overrides any previous set value using {@link #expectedMessageCount(int)} */ public void expectedBodiesReceivedInAnyOrder(Object... bodies) { List<Object> bodyList = new ArrayList<Object>();