JobTransformer { StringReader applyConfXslt(InputStream stream) throws JobTransformerException { StringWriter stringWriter = new StringWriter(); try { this.confTransformer.transform(new StreamSource(stream), new StreamResult(stringWriter)); } catch (TransformerException exception) { throw new JobTransformerException(exception); } return new StringReader(stringWriter.toString()); } JobTransformer();   }
@Test public void canTransformConf() throws Exception { StringReader reader = jobTransformer.applyConfXslt(getSampleConfInputStream()); String transformedString = IOUtils.toString(reader); assertThat(transformedString, equalTo("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<conf>" + "<path>hdfs: "<workflowType>L2</workflowType>" + "</conf>")); reader.close(); }