"</TestMessage>");
}
@Test
public void testTranslateWithVariables() {
Message message = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestMessage><Text name=\"\">Hello World!</Text><OtherText>No changes</OtherText></TestMessage>");
Map<String, String> mappings = new HashMap<String, String>();
mappings.put("TestMessage.Text", "${newText}");
mappings.put("TestMessage.Text.name", "citrus:upperCase('text')");
context.setVariable("newText", "Hello!");
NodeMappingDataDictionary dictionary = new NodeMappingDataDictionary();
dictionary.setMappings(mappings);
Message intercepted = dictionary.interceptMessage(message, CitrusConstants.DEFAULT_MESSAGE_TYPE, context);
Assert.assertEquals(intercepted.getPayload().toString().trim(), "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestMessage>" + System.getProperty("line.separator") +
" <Text name=\"TEXT\">Hello!</Text>" + System.getProperty("line.separator") +
" <OtherText>No changes</OtherText>" + System.getProperty("line.separator") +
"</TestMessage>");
}