add test for producing a text output using <xsl:output method="text" encoding="UTF-8" /> relates to INT-1838
This commit is contained in:
@@ -155,6 +155,15 @@ public class XsltPayloadTransformerTests {
|
||||
assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void docInStringOut() throws Exception {
|
||||
transformer = new XsltPayloadTransformer(getXslResourceThatOutputsText());
|
||||
transformer.setResultFactory(new StringResultFactory());
|
||||
transformer.setAlwaysUseResultFactory(true);
|
||||
Object returned = transformer.doTransform(buildMessage(XmlTestUtil.getDocumentForString(docAsString)));
|
||||
assertEquals("Wrong type of return ", StringResult.class, returned.getClass());
|
||||
assertEquals("Wrong content in string", "hello world", returned.toString());
|
||||
}
|
||||
|
||||
protected Message<?> buildMessage(Object payload) {
|
||||
return MessageBuilder.withPayload(payload).build();
|
||||
@@ -165,6 +174,11 @@ public class XsltPayloadTransformerTests {
|
||||
return new ByteArrayResource(xsl.getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
private Resource getXslResourceThatOutputsText() throws Exception {
|
||||
String xsl = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"text\" encoding=\"UTF-8\" /><xsl:template match=\"order\">hello world</xsl:template></xsl:stylesheet>";
|
||||
return new ByteArrayResource(xsl.getBytes("UTF-8"));
|
||||
}
|
||||
|
||||
public static class StubResultTransformer implements ResultTransformer {
|
||||
|
||||
private Object objectToReturn;
|
||||
|
||||
Reference in New Issue
Block a user