camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owain <>
Subject Restoring body from header holding MyPojo works differently in test (with mock) than production
Date Thu, 25 May 2017 12:24:47 GMT
Camel 2.19.0

I have a route that saves the Pojo in the exchange body to a header, does an
enrich to another route and then restores the original body from the header.  

          .setBody().method(MyPojo.class, "validate(${headers})")
              .when().simple("${body.getStatus()} == \"200\"")
                  .log(LoggingLevel.INFO, "Body class: ${body.class}")
          .marshal().json(JsonLibrary.Jackson, true)

When testing I mock out the enrich just returning a string as follows:

    camelContext.getRouteDefinition(ROUTE_ID).adviceWith(camelContext, new
AdviceWithRouteBuilder() {
      public void configure() throws Exception {

    MockEndpoint mockOut = camelContext.getEndpoint(MOCK_OUT,
    MockEndpoint mockEnrich = camelContext.getEndpoint(MOCK_ENRICH,


All works fine in this test as the body is restored correctly from the
header as can be seen this log message.

i4ip-ValidateOrder                       : Body class: class mydomain.MyPojo

However, when I run the Spring Boot application "properly" the class of the
body changes to:

i4ip-ValidateOrder                       : Body class: class

which causes problems later in the route with a ParameterBindingException
when the transform().method(....) is invoked.

I am not sure where to look to find out what is causing this.

Thanks for your help.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message