You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by zappee <ar...@gmail.com> on 2016/02/20 00:13:44 UTC
expectedMessageCount is not considered
Hi,
How can I set the value of the expected message count? In my test scenario
it is set to 200 but I got a Expected: <1> but was: <0> instead of
Expected: <200> but was: <0>
MockEndpoint resultEndpoint = getMockEndpoint(ENDPOINT_URL);
resultEndpoint.expectedMessageCount(200);
resultEndpoint.expectedBodyReceived().body().contains("okay");
template.sendBodyAndHeader(ENDPOINT_URL, "abc");
assertMockEndpointsSatisfied();
Error message:
java.lang.AssertionError: mock://result Received message count. Expected:
<1> but was: <0>
Expected :<1>
Actual :<0>
What did I do wrong?
--
View this message in context: http://camel.465427.n5.nabble.com/expectedMessageCount-is-not-considered-tp5777959.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: expectedMessageCount is not considered
Posted by zappee <ar...@gmail.com>.
Thank you, now I understand it.
--
View this message in context: http://camel.465427.n5.nabble.com/expectedMessageCount-is-not-considered-tp5777959p5777965.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: expectedMessageCount is not considered
Posted by Claus Ibsen <cl...@gmail.com>.
The expectedBodyReceived will override the count, where you set only 1
body and hence 1 message received.
If you want to expect that all message bodies contains okay, then use
.allMessages().body(). instead
On Sat, Feb 20, 2016 at 12:13 AM, zappee <ar...@gmail.com> wrote:
> Hi,
>
> How can I set the value of the expected message count? In my test scenario
> it is set to 200 but I got a Expected: <1> but was: <0> instead of
> Expected: <200> but was: <0>
>
> MockEndpoint resultEndpoint = getMockEndpoint(ENDPOINT_URL);
> resultEndpoint.expectedMessageCount(200);
> resultEndpoint.expectedBodyReceived().body().contains("okay");
> template.sendBodyAndHeader(ENDPOINT_URL, "abc");
> assertMockEndpointsSatisfied();
>
> Error message:
> java.lang.AssertionError: mock://result Received message count. Expected:
> <1> but was: <0>
> Expected :<1>
> Actual :<0>
>
>
> What did I do wrong?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/expectedMessageCount-is-not-considered-tp5777959.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2