This is an automated email from the ASF dual-hosted git repository. orpiske 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 70614e63c1d CAMEL-19685: increase logging in camel-mock 70614e63c1d is described below commit 70614e63c1d0a5cb5b46ba23200dd17ae7113ab6 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Tue Aug 1 11:21:50 2023 +0200 CAMEL-19685: increase logging in camel-mock --- .../org/apache/camel/component/mock/MockEndpoint.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 d3738d21c90..44d11ef3f18 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 @@ -1797,10 +1797,27 @@ public class MockEndpoint extends DefaultEndpoint implements BrowsableEndpoint, protected void assertEquals(String message, Object expectedValue, Object actualValue) { if (!ObjectHelper.equal(expectedValue, actualValue)) { + logReceivedExchanges(); + fail(message + ". Expected: <" + expectedValue + "> but was: <" + actualValue + ">"); } } + private void logReceivedExchanges() { + for (Exchange exchange : receivedExchanges) { + LOG.warn("Received exchange: {}", exchange); + final Message exchangeMessage = exchange.getMessage(); + if (exchangeMessage != null) { + LOG.warn("Received exchange message: {}", exchangeMessage); + final Object body = exchangeMessage.getBody(); + if (body != null) { + LOG.warn("Received exchange message body: {}", body); + LOG.warn("Received exchange message body type: {}", body.getClass()); + } + } + } + } + /** * Asserts that the given {@code predicate} is {@code true}, if not an {@code AssertionError} is raised with the * give message.