@Test public void testFormatTemplateShouldCallGenerateResponseOnXslResponseGenerator() throws Exception { params.addParameter(new Parameter(XSL_PARAM_KEY, XSL_PARAM_KEY)); given(stubResourcePathProvider.getTemplatesPathAsString()).willReturn(XSL_PARAM_KEY); given(fileFactory.createFile(Mockito.anyString())).willReturn(file); given(fileUtils.getFileAsByteArray(file)).willReturn(templateResource); given(wilmaRequest.getBody()).willReturn(XSL_PARAM_KEY); underTest.formatResponse(wilmaRequest, response, templateResource, params); verify(xslResponseGenerator).generateResponse(XSL_PARAM_KEY.getBytes(), templateResource, templateResource); }
@Override public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp, final byte[] templateResource, final ParameterList params) throws Exception { String xslResourcePath = checkAndGetXslResourcePath(params); byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath); byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8); return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource); }
XslBasedResponseFormatter implements ResponseFormatter { @Override public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp, final byte[] templateResource, final ParameterList params) throws Exception { String xslResourcePath = checkAndGetXslResourcePath(params); byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath); byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8); return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource); } }
XslBasedResponseFormatter implements ResponseFormatter { @Override public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp, final byte[] templateResource, final ParameterList params) throws Exception { String xslResourcePath = checkAndGetXslResourcePath(params); byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath); byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8); return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource); }  }
XslBasedResponseFormatter implements ResponseFormatter { @Override public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp, final byte[] templateResource, final ParameterList params) throws Exception { String xslResourcePath = checkAndGetXslResourcePath(params); byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath); byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8); return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource); }  @Override byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp,
                                 final byte[] templateResource, final ParameterList params); }
XslBasedResponseFormatter implements ResponseFormatter { @Override public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp, final byte[] templateResource, final ParameterList params) throws Exception { String xslResourcePath = checkAndGetXslResourcePath(params); byte[] xslResource = readXslResourceFromFileSystem(xslResourcePath); byte[] requestXmlResource = wilmaRequest.getBody().getBytes(StandardCharsets.UTF_8); return xslResponseGenerator.generateResponse(requestXmlResource, xslResource, templateResource); }  @Override byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp,
                                 final byte[] templateResource, final ParameterList params);  }