CAMEL-11589: Fixing issue with MockEndpoint.expectedPropertyReceived. This closes #1842.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae8fc550 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae8fc550 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae8fc550 Branch: refs/heads/master Commit: ae8fc55053abbdfdcbcc033660542a4d90329592 Parents: c80ccfe Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Jul 25 14:07:47 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Jul 25 14:07:47 2017 +0200 ---------------------------------------------------------------------- .../camel/component/mock/MockEndpointTest.java | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ae8fc550/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java b/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java index 104059a..e6074f6 100644 --- a/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java @@ -522,7 +522,7 @@ public class MockEndpointTest extends ContextTestSupport { } } - public void testPropertyNotReceived() throws Exception { + public void testPropertyExpectedNull() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(1); mock.expectedPropertyReceived("foo", null); @@ -534,8 +534,27 @@ public class MockEndpointTest extends ContextTestSupport { }); mock.assertIsNotSatisfied(); - } + resetMocks(); + + template.send("direct:a", new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.setProperty("foo", null); + } + }); + + mock.assertIsSatisfied(); + + resetMocks(); + + template.send("direct:a", new Processor() { + public void process(Exchange exchange) throws Exception { + // no foo property + } + }); + + mock.assertIsSatisfied(); + } public void testPropertyInvalidValue() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result");