You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mick Knutson <mk...@baselogic.com> on 2008/10/08 18:42:18 UTC

mock testing question about failure mock destination.

So I have a mock:failure destination that is getting 2 messages during my
test. I assert there should be 1 message.
I assume that the reason I am getting 2 messages is because of a retry. Is
this true?

here is my route:
            *public void configure() {
                errorHandler(
                        deadLetterChannel()
                                .exceptionPolicyStrategy(new
ChangeRequestExceptionPolicy())
                );

                onException(ChangeRequestExceptionPolicy.class)
                        .maximumRedeliveries(1)
                        .setHeader("MESSAGE_INFO", constant("Damm my policy
exception"))
                        .to(outputErrorUri);

                onException(CamelException.class)
                        .maximumRedeliveries(1)
                        .setHeader("MESSAGE_INFO", constant("Damm a Camel
exception"))
                        .to(outputErrorUri);

                onException(RuntimeException.class)
                        .maximumRedeliveries(1)
                        .setHeader("MESSAGE_INFO", constant("Damm a
RuntimeException"))
                        .to(outputErrorUri);

                from(inputUri)

.errorHandler(deadLetterChannel(outputErrorUri).maximumRedeliveries(1))
                        .process(processor)
                        .to(outputUri);
            }
        };
*


Then another question is, should I change my test from:
*expectedMessageCount(1)
*

to:
*expectedMinimumMessageCount(1)
*



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com