[ https://issues.apache.org/jira/browse/CAMEL-4395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Zhemzhitsky closed CAMEL-4395. ------------------------------------- Resolution: Won't Fix Closing this issue because it has already been fixed on trunk > MockEndpoint should save copies of received exchanges. > ------------------------------------------------------ > > Key: CAMEL-4395 > URL: https://issues.apache.org/jira/browse/CAMEL-4395 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.8.0 > Reporter: Sergey Zhemzhitsky > > MockEndpoint should save copies of received exchanges, because it's hardly > possible to attach a custom processor that modifies the exchange and perform > assertions by means of expectedMessagesMatches. > It happens because at the time of evaluation of assertions the original > exchange has already been modified and it is not equal to the received > exchange. > {code} > mockEndpoint.whenExchangeReceived(1, new Processor() { > @Override > public void process(Exchange exchange) throws Exception { > Message out = exchange.getPattern().isOutCapable() ? > exchange.getOut() : exchange.getIn(); > Object newBody = getNewBodySomeHow(); > out.setBody(newBody); > } > }); > {code} > {code} > mockEndpoint.expectedMessagesMatches( > new Predicate() { > @Override > public boolean matches(Exchange exchange) { > Object actualBody = exchange.getIn().getBody(); // this body is > equal to newBody that was set by processor in the whenExchangeReceived method > Object expectedBody = getExpectedBodySomeHow(); > return compareExpectedBodyAndActualBody(expectedBody, actualBody); > } > } > ); > {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira