camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kraythe ." <kray...@gmail.com>
Subject Re: Mocking Camel Route Elements in JUnits
Date Tue, 29 Apr 2014 09:09:07 GMT
Mock the endpoints you want to replace and then use:

MockEndpoint mock = getMockEndpoint(... uri ...);
mock.whenAnyExchangeReceived(new Processor {
 .... and so on.
}

Use adviceWith to replace the real endpoints with the mocks.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*


On Mon, Apr 28, 2014 at 3:57 PM, Stanisław Kuś <stasiekk@gmail.com> wrote:

> Hi all !
>
>
>  I've got a question regarding Unit testing Routes in Camel. I'd like to
> test only the flow in my Routes having processors as Mockito mocks and
> producers sending to MockEndpoints + additionally be able to mock
> Processors defined in on* .
>
> I'm using Java DSL + Annotation - Style Spring DI Config
>
> What would be the better/easier way to acheive my goal with:
>
>    1.
>
>    @UseAdviceWith + @MockEndpoints + .adviceWithBuilder
>    2.
>
>    @UseAdviceWtih + repleacing singletons with Mockito Mocks in Spring Bean
>    Factory + replacing RouteDefinition in CamelContext before starting it.
>
>
>  Thanks for suggestions in advance,
>
> Best Regrads,
>
> Stanislaw
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message