@Test public void testTransformShouldReturnOutput() throws SaxonApiException, SAXException { given(xslCompiler.compileXsl(xslInputStream, processor)).willReturn(xsltExecutable); given(xsltExecutable.load()).willReturn(xsltTransformer); given(xslOutputProvider.getOutput(xsltTransformer)).willReturn(outputStream); setRequestMocks(); setTemplateMocks(); byte[] actual = underTest.transform(xslInputStream, requestInputStream, templateInputStream); assertEquals(actual, outputStream.toByteArray()); }
public byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream) throws SaxonApiException, SAXException { Processor processor = processorFactory.createProcessor(); XMLReader xmlReader = createXMLReader(); XsltExecutable xsltExecutable = xslCompiler.compileXsl(xslInputStream, processor); XsltTransformer xsltTransformer = xsltExecutable.load(); ByteArrayOutputStream output = xslOutputProvider.getOutput(xsltTransformer); setRequest(requestInputStream, processor, xsltTransformer); setTemplate(templateInputStream, processor, xmlReader, xsltTransformer); xsltTransformer.transform(); return output.toByteArray(); }
XslTransformer { public byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream) throws SaxonApiException, SAXException { Processor processor = processorFactory.createProcessor(); XMLReader xmlReader = createXMLReader(); XsltExecutable xsltExecutable = xslCompiler.compileXsl(xslInputStream, processor); XsltTransformer xsltTransformer = xsltExecutable.load(); ByteArrayOutputStream output = xslOutputProvider.getOutput(xsltTransformer); setRequest(requestInputStream, processor, xsltTransformer); setTemplate(templateInputStream, processor, xmlReader, xsltTransformer); xsltTransformer.transform(); return output.toByteArray(); } }
XslTransformer { public byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream) throws SaxonApiException, SAXException { Processor processor = processorFactory.createProcessor(); XMLReader xmlReader = createXMLReader(); XsltExecutable xsltExecutable = xslCompiler.compileXsl(xslInputStream, processor); XsltTransformer xsltTransformer = xsltExecutable.load(); ByteArrayOutputStream output = xslOutputProvider.getOutput(xsltTransformer); setRequest(requestInputStream, processor, xsltTransformer); setTemplate(templateInputStream, processor, xmlReader, xsltTransformer); xsltTransformer.transform(); return output.toByteArray(); }  }
XslTransformer { public byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream) throws SaxonApiException, SAXException { Processor processor = processorFactory.createProcessor(); XMLReader xmlReader = createXMLReader(); XsltExecutable xsltExecutable = xslCompiler.compileXsl(xslInputStream, processor); XsltTransformer xsltTransformer = xsltExecutable.load(); ByteArrayOutputStream output = xslOutputProvider.getOutput(xsltTransformer); setRequest(requestInputStream, processor, xsltTransformer); setTemplate(templateInputStream, processor, xmlReader, xsltTransformer); xsltTransformer.transform(); return output.toByteArray(); }  byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream); }
XslTransformer { public byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream) throws SaxonApiException, SAXException { Processor processor = processorFactory.createProcessor(); XMLReader xmlReader = createXMLReader(); XsltExecutable xsltExecutable = xslCompiler.compileXsl(xslInputStream, processor); XsltTransformer xsltTransformer = xsltExecutable.load(); ByteArrayOutputStream output = xslOutputProvider.getOutput(xsltTransformer); setRequest(requestInputStream, processor, xsltTransformer); setTemplate(templateInputStream, processor, xmlReader, xsltTransformer); xsltTransformer.transform(); return output.toByteArray(); }  byte[] transform(final InputStream xslInputStream, final InputStream requestInputStream, final InputStream templateInputStream);  }