This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ccf6e22ae4e Added test based on user problem
ccf6e22ae4e is described below
commit ccf6e22ae4e9c14faafcbc3fc0330fe8e90a14d3
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Dec 7 20:08:59 2022 +0100
Added test based on user problem
---
.../apache/camel/component/mock/MockEndpointTest.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
index 17b84ffe0cb..df9f60b5230 100644
---
a/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/component/mock/MockEndpointTest.java
@@ -30,6 +30,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.Language;
import org.apache.camel.spi.Registry;
import org.junit.jupiter.api.Test;
@@ -1224,6 +1225,22 @@ public class MockEndpointTest extends ContextTestSupport
{
assertEquals("<message>10</message>",
mock.getReceivedExchanges().get(9).getIn().getBody());
}
+ @Test
+ public void testExpectedMessagesMatches() throws Exception {
+ Language sl = context.resolveLanguage("simple");
+ MockEndpoint mock = getMockEndpoint("mock:result");
+
+ mock.expectedMessagesMatches(sl.createPredicate("${body} == 'abc'"));
+ template.sendBody("direct:a", "abc");
+ mock.assertIsSatisfied();
+
+ mock.reset();
+
+ mock.expectedMessagesMatches(sl.createPredicate("${body} == 'abc'"));
+ template.sendBody("direct:a", "def");
+ mock.assertIsNotSatisfied();
+ }
+
protected void sendMessages(int... counters) {
for (int counter : counters) {
template.sendBodyAndHeader("direct:a", createTestMessage(counter),
"counter", counter);