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.minhs...@gmail.com] > Gesendet: Freitag, 4. Juli 2014 04:00 > An: users@camel.apache.org > Betreff: MockEndPoint expected methods clashing > > Hi > > Im 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?