Maybe try with

@MockEndpointsAndSkip("*")

On Fri, Dec 20, 2013 at 12:31 PM, sebh <sebastian.haeh...@gmail.com> wrote:
> Hi,
>
> I am using Camel 2.12.2 and Spring 3.2.4. I have the following route
> definition:
>
> <camelContext xmlns="http://camel.apache.org/schema/spring";>
>   <route id="route1">
>     <from uri="direct:route1" />
>     <to uri="direct:route2"/>
>   </route>
> </camelContext>
>
> My expectation would be that the following test succeeds:
>
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @ContextConfiguration
> @MockEndpointsAndSkip
> public class RouteTest {
>         @Produce(uri="direct:route1") private ProducerTemplate producer;
>         @EndpointInject(uri="mock:direct:route2") private MockEndpoint 
> endpoint;
>
>         @Test public void test_fails() throws Exception {
>                 final Object body = new Integer(42);
>                 endpoint.expectedBodiesReceived(body);
>                 producer.sendBody(body);
>                 endpoint.assertIsSatisfied(); // fails, 0 messages received
>         }
> }
>
> The test succeeds when I use @MockEndpointsAndSkip("direct:route2") instead.
>
> Manipulating the route definition with the AdviceWithRouteBuilder works as
> well:
>
>                 context.getRouteDefinition("route1").adviceWith(context, new
> AdviceWithRouteBuilder() {
>                         @Override public void configure() throws Exception {
>                                 mockEndpointsAndSkip("*");
>                         }
>                 });
>
> Is that intended?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/MockEndpointsAndSkip-appears-to-not-mock-all-endpoints-when-testing-with-Spring-tp5745105.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to