I'm confused about how expectedBodiesReceived behaves.

I have a route where I mock a jms endpoint (the endpoint is sent to in
an onException route as follows:

 <camel:onException>

<camel:exception>java.lang.Exception</camel:exception>
                                <camel:handled>
                                        <camel:constant>true</camel:constant>
                                </camel:handled>
                                <camel:to
id="inboundFromRtsErrorQueue"
uri="jms:queue:{{rts.online.mq.reservationsReceiveErrorQueue}}?connectionFactory=#rtsConnectionFactory&amp;destinationResolver=#rtsDestinationResolver"
/>


I then override the sending to inboundFromRtsErrorQueue by id in the
setup of my testclass.

Everything works ok:


        mockInboundFromRtsErrorQueue.setExpectedMessageCount( 1 );
        Exchange failedExchange =
mockInboundFromRtsErrorQueue.getExchanges().get( 0 );
        Assert.assertEquals( payload, failedExchange.getIn().getBody() );
        //mockInboundFromRtsErrorQueue.expectedBodiesReceived( payload
); //strangely this does not pass - but the above does
        mockInboundFromRtsErrorQueue.assertIsSatisfied();


but I'm surprised that if I comment in the second-last line it will
fail. Why? As line no 2&3 does exactly the same??

-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Reply via email to