Jamie goodyear created CAMEL-8327:
-------------------------------------

             Summary: ContextTestSupport does not support weaveByType in test 
cases
                 Key: CAMEL-8327
                 URL: https://issues.apache.org/jira/browse/CAMEL-8327
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.13.3
            Reporter: Jamie goodyear
             Fix For: 2.13.4, 2.14.2


Update AdviceWithTypeTest test class to contain the below. On Camel-2.13.2 and 
below the test case would pass, on 2.13.3 and above the test case fails.

{code:title=AdviceWithTypeTest.java|borderStyle=solid}
    public void testUnknownType2() throws Exception {
       
        context.getRouteDefinitions().get(0).adviceWith(context, new 
AdviceWithRouteBuilder() {
            @Override
            public void configure() throws Exception {
                weaveByType(ChoiceDefinition.class).replace().to("mock:baz");
            }
        });
       
        getMockEndpoint("mock:baz").expectedMessageCount(1);
        template.sendBody("direct:start", "World");
        assertMockEndpointsSatisfied();
    }
 
 
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // START SNIPPET: e5
                from("direct:start")
                    .transform(simple("Hello ${body}"))
                    .log("Got ${body}")
                    .to("mock:result")
                    .choice()
                    .when(header("foo").isEqualTo("bar"))
                       .to("mock:resultA")
                    .otherwise()
                       .to("mock:resultB");
                // END SNIPPET: e5
            }
        };
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to