Hi See advice with where you can replace the uri of pollEnrich in the unit test http://camel.apache.org/advicewith.html
Or you can use property placeholders for the uris, and then use a different .properties file for unit testing http://camel.apache.org/using-propertyplaceholder.html On Thu, Jul 19, 2012 at 5:45 PM, sensen <n.sen...@web.de> wrote: > Hello, > I love the test-support of camel. > Unfortunately, currently I have a problem: I want to create a route which > uses > a PollEnrich-component. And I want to write a test which mocks away the URI > which > is used by the pollEnrich-component. > > But I cannot manage this. I tried the following test, which fails. > This means: Firstly the assertMockEndpointsSatisfied fails and > secondly, when the route is executed it in fact accesses the endpoint > file:asfd. (But it should not use this file since I wanted to mock > it away) > > Any hints, how I can manage that the pollEnrich is mocked? > > @@Test > public class TestPollEnrich extends CamelTestSupport > { > @Override > public String isMockEndpointsAndSkip() > { return "file:*"; } > > public void testStdFlow() throws Exception > { > getMockEndpoint("mock://file:asfd").expectedMessageCount(1); > super.sendBody("direct:start", "egal"); > assertMockEndpointsSatisfied(); > } > > @Override > protected RouteBuilder createRouteBuilder() throws Exception > { > return new RouteBuilder() > { @Override > public void configure() throws Exception > { from("direct:start").pollEnrich("file:asfd"); } > }; > } > } > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/testing-pollEnrich-via-mock-tp5716258.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen