camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: MockEndPoint expected methods clashing
Date Fri, 04 Jul 2014 07:34:29 GMT
expectedBodies also set expected number of messages. So you say 2
bodies expected and then 12 message later. That is a mis match.

On Fri, Jul 4, 2014 at 7:20 AM, Jan Matèrne (jhm) <apache@materne.de> wrote:
> I ran into the same problem some ago with another expect* method.
> These methods set the extpectedMessageCount to the number of arguments.
>
> The simplest thing what you could do is:
> endpoint.setExpectedBodies(“hello”, "hello");
>
> I am not sure that changing the order would work
> endpoint.setExpectedBodies(“hello”);
> endpoint.setExpectedMessageCount(2);
>
> You could write the test for yourself:
> expects(new Runnable(){
>   ...
> });
>
> Or use allMessages() ...
>
>
> Jan
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Minh Tran [mailto:darth.minhster@gmail.com]
>> Gesendet: Freitag, 4. Juli 2014 04:00
>> An: users@camel.apache.org
>> Betreff: MockEndPoint expected methods clashing
>>
>> Hi
>>
>> I’m calling setExpectedMessageCount and expectedBodiesReceived like
>> this and seeing odd behaviour
>>
>> endpoint.setExpectedMessageCount(2);
>> endpoint.setExpectedBodies(“hello”);
>>
>> I would expect that it will attempt to find 2 messages with both bodies
>> containing “hello”. Instead it appears as though the second call
>> overwrites the expected message count back to 1. Is this expected
>> behaviour?
>>
>> If so, how do I achieve what I want so that it finds the number of
>> messages I need without me having to specify the body over and over?
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message