Skip to content

Commit

Permalink
Added an extract field tests for horizontal tab escaping
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
  • Loading branch information
oscerd committed Jul 12, 2023
1 parent 4983057 commit fc13a94
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,18 @@ void shouldExtractFieldToDefaultHeader() throws Exception {
Assertions.assertEquals("Rajesh Koothrappali", exchange.getMessage().getHeader(ExtractField.EXTRACTED_FIELD_HEADER));
}

@Test
void shouldExtractFieldWithT() throws Exception {
final String baseJson = "{\"id\":\"1\",\"message\":\"Camel\\\\tRocks\"}";
Exchange exchange = new DefaultExchange(camelContext);

exchange.getMessage().setBody(mapper.readTree(baseJson));

processor.setField("message");
processor.setTrimField(true);
processor.process(exchange);

Assertions.assertEquals("Camel\\tRocks", exchange.getMessage().getBody());
}

}

0 comments on commit fc13a94

Please sign in to comment.