CamelMessageConverter implements MessageConverter<Exchange, Exchange, CamelEndpointConfiguration> { @Override public Exchange convertOutbound(Message message, CamelEndpointConfiguration endpointConfiguration, TestContext context) { Exchange exchange = new DefaultExchange(endpointConfiguration.getCamelContext()); convertOutbound(exchange, message, endpointConfiguration, context); return exchange; }  @Override Exchange convertOutbound(Message message, CamelEndpointConfiguration endpointConfiguration, TestContext context); @Override void convertOutbound(Exchange exchange, Message message, CamelEndpointConfiguration endpointConfiguration, TestContext context); @Override Message convertInbound(Exchange exchange, CamelEndpointConfiguration endpointConfiguration, TestContext context);  }
@Test public void testConvertOutbound() { Message message = new DefaultMessage("Hello from Citrus!") .setHeader("operation", "sayHello"); Exchange exchange = messageConverter.convertOutbound(message, endpointConfiguration, context); Assert.assertEquals(exchange.getIn().getBody(), "Hello from Citrus!"); Assert.assertEquals(exchange.getIn().getHeaders().get("operation"), "sayHello"); }
@Test public void testConvertOutboundExchange() { Message message = new DefaultMessage("Hello from Citrus!") .setHeader("operation", "sayHello"); Exchange exchange = new DefaultExchange(camelContext); exchange.setExchangeId(UUID.randomUUID().toString()); messageConverter.convertOutbound(exchange, message, endpointConfiguration, context); Assert.assertEquals(exchange.getIn().getBody(), "Hello from Citrus!"); Assert.assertEquals(exchange.getIn().getHeaders().get("operation"), "sayHello"); }