Ok, figured it out. It helps if you don't write:

errorBin.assertIsNotSatisfied();

rather than:

errorBin.assertIsSatisfied();

I blame code complete :D



On 27 January 2013 22:41, Mark Doyle <markjohndo...@gmail.com> wrote:

> Just noticed the test code only shows up on the nabble web interface.
>
> This is the createRouteBuilder configure contents:
>
> from("mina2:tcp://localhost:12345?sync=false&codec=#kissFrameSyncCodecFactory").
> setExchangePattern(ExchangePattern.InOnly).
> bean(hdlcFrameDecoder).
> doTry().
>     bean(packetDecoder).
>     bean(payloadCodec).
>     to("direct:decodedParameterGroups").
> doCatch(Exception.class).
>     to(errorBin).
> end();
>
>
> from("direct:start").
> to("mina2:tcp://localhost:12345?sync=false");
>
>
> from("direct:decodedParameterGroups").
> split().simple("body.getAllParametersAsList").
>     to(resultEndpoint).
> end();
>
>
>
> The test causing the problem is as follows:
>
>
> @Test
>
> public void testIntegrationFullTransportChainEmergency() throws Exception {
>
>     resultEndpoint.setExpectedMessageCount(52);
>     resultEndpoint.allMessages().body().isInstanceOf(Parameter.class);
>     errorBin.setExpectedMessageCount(215); <-- I can set this to anything and 
> the test passes.
>
>     directStart.sendBody(emergencyArray); <-- This is a simple byte array 
> pumped into the test
>
>     System.out.println("Asserting results");
>     resultEndpoint.setAssertPeriod(5000);
>     resultEndpoint.assertIsSatisfied();
>     System.out.println("Asserting errorBin");
>     errorBin.setAssertPeriod(5000);
>     errorBin.assertIsNotSatisfied();
> }
>
>
>
> On 27 January 2013 17:51, Christian Müller <christian.muel...@gmail.com>wrote:
>
>> Can you share your test with us?
>> Even better if you can share a working unit test so that we can run the
>> test and see what's going wrong.
>> And for every question, it's good to know which version of Camel do you
>> use.
>>
>> Best,
>> Christian
>>
>> On Sun, Jan 27, 2013 at 2:10 PM, MarkD <markjohndo...@googlemail.com>
>> wrote:
>>
>> > Hi all,
>> >
>> > I have the following test route in my createRouteBuilder method of the
>> > test:
>> >
>> >
>> >
>> > The test data includes some input that throws exceptions so I am
>> expecting
>> > those to end up in the mock endpoint called errorBin. This does seem to
>> be
>> > the case. If I put a log after the docatch and before the to(errorBin) I
>> > see
>> > the log message.
>> >
>> > However, when I try to do asserts on this it doesn't seem to work. I can
>> > set
>> > expected messages to any value, including 0, and the test always passes!
>> > Can
>> > anybody see any obvious reason why this is happening?
>> >
>> > Note, the asserts I perform on the resultEndpoint work perfectly.
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://camel.465427.n5.nabble.com/Trouble-with-asserts-on-a-mockendpoint-receiving-caught-exceptions-tp5726373.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>>
>>
>>
>> --
>>
>
>

Reply via email to