コード例 #1
0
 @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();
 }
コード例 #2
0
 @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());
 }