@Test public void shouldCreateADocumentAndWriteToResponse() throws Exception { OpenLmisPdfView pdfView = new OpenLmisPdfView(messageService); Map<String, Object> model = new HashMap<>(); HttpServletRequest request = new MockHttpServletRequest(); HttpServletResponse response = new MockHttpServletResponse(); RequisitionPdfWriter writer = mock(RequisitionPdfWriter.class); whenNew(RequisitionPdfWriter.class).withAnyArguments().thenReturn(writer); pdfView.renderMergedOutputModel(model, request, response); verify(writer).buildWith(model); }
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { try (ByteArrayOutputStream stream = createTemporaryOutputStream()) { RequisitionPdfWriter requisitionPdfWriter = new RequisitionPdfWriter(new PdfDocument(), stream, messageService, configService); requisitionPdfWriter.buildWith(model); writeToResponse(response, stream); } }
OpenLmisPdfView extends AbstractView { @Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { try (ByteArrayOutputStream stream = createTemporaryOutputStream()) { RequisitionPdfWriter requisitionPdfWriter = new RequisitionPdfWriter(new PdfDocument(), stream, messageService, configService); requisitionPdfWriter.buildWith(model); writeToResponse(response, stream); } } }
OpenLmisPdfView extends AbstractView { @Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { try (ByteArrayOutputStream stream = createTemporaryOutputStream()) { RequisitionPdfWriter requisitionPdfWriter = new RequisitionPdfWriter(new PdfDocument(), stream, messageService, configService); requisitionPdfWriter.buildWith(model); writeToResponse(response, stream); } } @Autowired  OpenLmisPdfView(MessageService messageService); }
OpenLmisPdfView extends AbstractView { @Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { try (ByteArrayOutputStream stream = createTemporaryOutputStream()) { RequisitionPdfWriter requisitionPdfWriter = new RequisitionPdfWriter(new PdfDocument(), stream, messageService, configService); requisitionPdfWriter.buildWith(model); writeToResponse(response, stream); } } @Autowired  OpenLmisPdfView(MessageService messageService);  }
OpenLmisPdfView extends AbstractView { @Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { try (ByteArrayOutputStream stream = createTemporaryOutputStream()) { RequisitionPdfWriter requisitionPdfWriter = new RequisitionPdfWriter(new PdfDocument(), stream, messageService, configService); requisitionPdfWriter.buildWith(model); writeToResponse(response, stream); } } @Autowired  OpenLmisPdfView(MessageService messageService);   }