@Test(expectedExceptions = ResponseFormattingFailedException.class) public void testGenerateResponseWhenSaxonApiExceptionDuringTransformShouldThrowException() throws SaxonApiException, SAXException { given(transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml)) .willThrow(new SaxonApiException("exception")); underTest.generateResponse(requestXml, xsl, templateXml, nameToXml); }
public byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml) { byte[] result; InputStream requestInputStream = inputStreamFactory.createByteArrayInputStream(requestXmlResource); InputStream xslInputStream = inputStreamFactory.createByteArrayInputStream(xsl); InputStream templateInputStream = inputStreamFactory.createByteArrayInputStream(template); try { result = transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); } catch (Exception e) { throw new ResponseFormattingFailedException("Template formatting failed with xslt:" + xsl, e); } return result; }
SequenceAwareXslResponseGenerator { public byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml) { byte[] result; InputStream requestInputStream = inputStreamFactory.createByteArrayInputStream(requestXmlResource); InputStream xslInputStream = inputStreamFactory.createByteArrayInputStream(xsl); InputStream templateInputStream = inputStreamFactory.createByteArrayInputStream(template); try { result = transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); } catch (Exception e) { throw new ResponseFormattingFailedException("Template formatting failed with xslt:" + xsl, e); } return result; } }
SequenceAwareXslResponseGenerator { public byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml) { byte[] result; InputStream requestInputStream = inputStreamFactory.createByteArrayInputStream(requestXmlResource); InputStream xslInputStream = inputStreamFactory.createByteArrayInputStream(xsl); InputStream templateInputStream = inputStreamFactory.createByteArrayInputStream(template); try { result = transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); } catch (Exception e) { throw new ResponseFormattingFailedException("Template formatting failed with xslt:" + xsl, e); } return result; }  }
SequenceAwareXslResponseGenerator { public byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml) { byte[] result; InputStream requestInputStream = inputStreamFactory.createByteArrayInputStream(requestXmlResource); InputStream xslInputStream = inputStreamFactory.createByteArrayInputStream(xsl); InputStream templateInputStream = inputStreamFactory.createByteArrayInputStream(template); try { result = transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); } catch (Exception e) { throw new ResponseFormattingFailedException("Template formatting failed with xslt:" + xsl, e); } return result; }  byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml); }
SequenceAwareXslResponseGenerator { public byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml) { byte[] result; InputStream requestInputStream = inputStreamFactory.createByteArrayInputStream(requestXmlResource); InputStream xslInputStream = inputStreamFactory.createByteArrayInputStream(xsl); InputStream templateInputStream = inputStreamFactory.createByteArrayInputStream(template); try { result = transformer.transform(xslInputStream, requestInputStream, templateInputStream, nameToXml); } catch (Exception e) { throw new ResponseFormattingFailedException("Template formatting failed with xslt:" + xsl, e); } return result; }  byte[] generateResponse(final byte[] requestXmlResource, final byte[] xsl, final byte[] template, final Map<String, String> nameToXml);  }