Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8327

ContextTestSupport does not support weaveByType in test cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.13.3, 2.14.1
    • 2.13.4, 2.14.2, 2.15.0
    • camel-core
    • None
    • Unknown

    Description

      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.

      AdviceWithTypeTest.java
          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
                  }
              };
          }
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            jgoodyear Jamie Mark Goodyear
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: