@Test public void testGenerateResponseShouldReturnTemplateResourceAndSetResponseHeadersWhenResponseFormatterDefined() throws Exception { ParameterList params = new ParameterList(); responseFormatterDescriptors.add(responseFormatterDescriptor); mockTemplateResource(); given(responseFormatterDescriptor.getParams()).willReturn(params); given(responseFormatterDescriptor.getResponseFormatter()).willReturn(responseFormatter); given(responseFormatter.formatResponse(wilmaRequest, response, templateResource, params)).willReturn(templateResource); byte[] actual = underTest.generateResponse(request, response); verify(headerConfigurer).setResponseContentTypeAndStatus(response, responseDescriptorDTO); Assert.assertEquals(actual, templateResource); }
public byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp) { String wilmaLoggerId = req.getHeader(WilmaHttpRequest.WILMA_LOGGER_ID); byte[] result = null; if (wilmaLoggerId != null) { ResponseDescriptorDTO responseDescriptorDTO = mapBasedResponseDescriptorAccess.getResponseDescriptor(wilmaLoggerId); Set<ResponseFormatterDescriptor> responseFormatterDescriptors = responseDescriptorDTO.getResponseDescriptor().getResponseFormatters(); WilmaHttpRequest wilmaRequest = httpServletRequestTransformer.transformToWilmaHttpRequest(wilmaLoggerId, req, responseDescriptorDTO); stubResponseHeaderConfigurer.addWilmaInfoToResponseHeader(req, resp, responseDescriptorDTO.getDialogDescriptorName()); result = generate(resp, responseDescriptorDTO, responseFormatterDescriptors, wilmaRequest); } return result; }
StubResponseGenerator { public byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp) { String wilmaLoggerId = req.getHeader(WilmaHttpRequest.WILMA_LOGGER_ID); byte[] result = null; if (wilmaLoggerId != null) { ResponseDescriptorDTO responseDescriptorDTO = mapBasedResponseDescriptorAccess.getResponseDescriptor(wilmaLoggerId); Set<ResponseFormatterDescriptor> responseFormatterDescriptors = responseDescriptorDTO.getResponseDescriptor().getResponseFormatters(); WilmaHttpRequest wilmaRequest = httpServletRequestTransformer.transformToWilmaHttpRequest(wilmaLoggerId, req, responseDescriptorDTO); stubResponseHeaderConfigurer.addWilmaInfoToResponseHeader(req, resp, responseDescriptorDTO.getDialogDescriptorName()); result = generate(resp, responseDescriptorDTO, responseFormatterDescriptors, wilmaRequest); } return result; } }
StubResponseGenerator { public byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp) { String wilmaLoggerId = req.getHeader(WilmaHttpRequest.WILMA_LOGGER_ID); byte[] result = null; if (wilmaLoggerId != null) { ResponseDescriptorDTO responseDescriptorDTO = mapBasedResponseDescriptorAccess.getResponseDescriptor(wilmaLoggerId); Set<ResponseFormatterDescriptor> responseFormatterDescriptors = responseDescriptorDTO.getResponseDescriptor().getResponseFormatters(); WilmaHttpRequest wilmaRequest = httpServletRequestTransformer.transformToWilmaHttpRequest(wilmaLoggerId, req, responseDescriptorDTO); stubResponseHeaderConfigurer.addWilmaInfoToResponseHeader(req, resp, responseDescriptorDTO.getDialogDescriptorName()); result = generate(resp, responseDescriptorDTO, responseFormatterDescriptors, wilmaRequest); } return result; }  }
StubResponseGenerator { public byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp) { String wilmaLoggerId = req.getHeader(WilmaHttpRequest.WILMA_LOGGER_ID); byte[] result = null; if (wilmaLoggerId != null) { ResponseDescriptorDTO responseDescriptorDTO = mapBasedResponseDescriptorAccess.getResponseDescriptor(wilmaLoggerId); Set<ResponseFormatterDescriptor> responseFormatterDescriptors = responseDescriptorDTO.getResponseDescriptor().getResponseFormatters(); WilmaHttpRequest wilmaRequest = httpServletRequestTransformer.transformToWilmaHttpRequest(wilmaLoggerId, req, responseDescriptorDTO); stubResponseHeaderConfigurer.addWilmaInfoToResponseHeader(req, resp, responseDescriptorDTO.getDialogDescriptorName()); result = generate(resp, responseDescriptorDTO, responseFormatterDescriptors, wilmaRequest); } return result; }  byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp); }
StubResponseGenerator { public byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp) { String wilmaLoggerId = req.getHeader(WilmaHttpRequest.WILMA_LOGGER_ID); byte[] result = null; if (wilmaLoggerId != null) { ResponseDescriptorDTO responseDescriptorDTO = mapBasedResponseDescriptorAccess.getResponseDescriptor(wilmaLoggerId); Set<ResponseFormatterDescriptor> responseFormatterDescriptors = responseDescriptorDTO.getResponseDescriptor().getResponseFormatters(); WilmaHttpRequest wilmaRequest = httpServletRequestTransformer.transformToWilmaHttpRequest(wilmaLoggerId, req, responseDescriptorDTO); stubResponseHeaderConfigurer.addWilmaInfoToResponseHeader(req, resp, responseDescriptorDTO.getDialogDescriptorName()); result = generate(resp, responseDescriptorDTO, responseFormatterDescriptors, wilmaRequest); } return result; }  byte[] generateResponse(final HttpServletRequest req, final HttpServletResponse resp);  }