@Test public void testTransformShouldDoTransform() throws SaxonApiException, SAXException { // GIVEN given(xslCompiler.compileXsl(xslInputStream, processor)).willReturn(xsltExecutable); given(xsltExecutable.load()).willReturn(xsltTransformer); given(xslOutputProvider.getOutput(xsltTransformer)).willReturn(outputStream); givenParameter("request", requestName); setTemplateMocks(); // WHEN underTest.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); // THEN verify(xsltTransformer).transform(); }
@Test public void testTransformShouldReturnOutput() throws SaxonApiException, SAXException { // GIVEN given(xslCompiler.compileXsl(xslInputStream, processor)).willReturn(xsltExecutable); given(xsltExecutable.load()).willReturn(xsltTransformer); given(xslOutputProvider.getOutput(xsltTransformer)).willReturn(outputStream); givenParameter("request", requestName); setTemplateMocks(); // WHEN byte[] actual = underTest.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); // THEN assertEquals(actual, outputStream.toByteArray()); }