diff --git a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockEndpoint.java index f0eba38018260..62c4910831c88 100644 --- a/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockEndpoint.java +++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/MockEndpoint.java @@ -802,15 +802,7 @@ private Object extractActualValue(Exchange exchange, Object actualValue, Object return null; } - if (actualValue instanceof Expression) { - Class clazz = Object.class; - if (expectedValue != null) { - clazz = expectedValue.getClass(); - } - actualValue = ((Expression) actualValue).evaluate(exchange, clazz); - } else if (actualValue instanceof Predicate) { - actualValue = ((Predicate) actualValue).matches(exchange); - } else if (expectedValue != null) { + if (expectedValue != null) { String from = actualValue.getClass().getName(); String to = expectedValue.getClass().getName(); actualValue = getCamelContext().getTypeConverter().convertTo(expectedValue.getClass(), exchange, actualValue); 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 a3834f89dc115..17b84ffe0cb72 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 @@ -29,9 +29,7 @@ import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.Processor; -import org.apache.camel.builder.ExpressionBuilder; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.language.xpath.XPathBuilder; import org.apache.camel.spi.Registry; import org.junit.jupiter.api.Test; @@ -282,28 +280,6 @@ public void testExpectationOfHeaderWithNumber() throws InterruptedException { resultEndpoint.assertIsSatisfied(); } - @Test - public void testExpressionExpectationOfHeader() throws InterruptedException { - MockEndpoint resultEndpoint = getMockEndpoint("mock:result"); - resultEndpoint.reset(); - - resultEndpoint.expectedHeaderReceived("number", 123); - template.sendBodyAndHeader("direct:a", "123", "number", - XPathBuilder.xpath("/foo/id", Integer.class)); - resultEndpoint.assertIsSatisfied(); - } - - @Test - public void testExpressionExpectationOfProperty() throws InterruptedException { - MockEndpoint resultEndpoint = getMockEndpoint("mock:result"); - resultEndpoint.reset(); - - resultEndpoint.expectedPropertyReceived("number", 123); - template.sendBodyAndProperty("direct:a", "123", "number", - XPathBuilder.xpath("/foo/id", Integer.class)); - resultEndpoint.assertIsSatisfied(); - } - @Test public void testAscending() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); @@ -1075,18 +1051,6 @@ public void testExpectedBodyTypeCoerce() throws Exception { assertMockEndpointsSatisfied(); } - @Test - public void testExpectedBodyExpression() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedBodiesReceived(987); - - // start with 0 (zero) to have it converted to the number and match 987 - // and since its an expression it would be evaluated first as well - template.sendBody("direct:a", ExpressionBuilder.constantExpression("0987")); - - assertMockEndpointsSatisfied(); - } - @Test public void testResetDefaultProcessor() throws Exception { final AtomicInteger counter = new AtomicInteger();