camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Zhemzhitsky (JIRA)" <>
Subject [jira] [Created] (CAMEL-4395) MockEndpoint should save copies of received exchanges.
Date Tue, 30 Aug 2011 14:07:37 GMT
MockEndpoint should save copies of received exchanges.

                 Key: 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.
mockEndpoint.whenExchangeReceived(1, new Processor() {
    public void process(Exchange exchange) throws Exception {
        Message out = exchange.getPattern().isOutCapable() ? exchange.getOut() : exchange.getIn();
        Object newBody = getNewBodySomeHow();

    new Predicate() {
        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);

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message