XslCompiler { public XsltExecutable compileXsl(final InputStream inputStream, final Processor processor) throws SaxonApiException { XsltCompiler xsltCompiler = processor.newXsltCompiler(); Source xslSource = streamSourceFactory.createStreamSource(inputStream); xsltCompiler.setErrorListener(errorListener); XsltExecutable xsltExecutable = xsltCompiler.compile(xslSource); return xsltExecutable; }  XsltExecutable compileXsl(final InputStream inputStream, final Processor processor);  }
@Test public void testCompileXslShouldCompileSource() throws SaxonApiException { given(processor.newXsltCompiler()).willReturn(xsltCompiler); given(streamSourceFactory.createStreamSource(inputStream)).willReturn(source); underTest.compileXsl(inputStream, processor); verify(xsltCompiler).compile(source); }
@Test public void testCompileXslShouldReturnXsltExecutable() throws SaxonApiException { given(processor.newXsltCompiler()).willReturn(xsltCompiler); given(streamSourceFactory.createStreamSource(inputStream)).willReturn(source); given(xsltCompiler.compile(source)).willReturn(xsltExecutable); XsltExecutable actual = underTest.compileXsl(inputStream, processor); assertEquals(actual, xsltExecutable); }