OperationalReport extends Report { public void getDownloadRendering(HttpServletRequest req, HttpServletResponse resp, String fileName, String format) throws IOException { getDownloadRendering(req, resp, fileName, format, null ); } OperationalReport();  OperationalReport(String name, String info, List<Parameter> parameters, ReportGenerator reportGenerator); String getRendering(String format); String getHTMLRendering(); void getDownloadRendering(HttpServletRequest req, HttpServletResponse resp, String fileName, String format); void getDownloadRendering(HttpServletRequest req, HttpServletResponse resp, String fileName, String format, String destinationURL);  }
@Test public final void testGetDownloadRendering1() { testOperationalReport(); try { HttpServletRequest req = new MockHttpServletRequest(); MockHttpServletResponse resp = new MockHttpServletResponse(); assertFalse(resp.containsHeader("Content-Disposition")); testInstance.getDownloadRendering(req, resp, "report", FileFactory.CSV_FORMAT); assertTrue(resp.containsHeader("Content-Disposition")); assertEquals(resp.getContentAsString(), expectedOutput); } catch(Exception e) { fail(e.getMessage()); } }
@Test public final void testGetDownloadRendering2() { testOperationalReport(); try { HttpServletRequest req = new MockHttpServletRequest(); MockHttpServletResponse resp = new MockHttpServletResponse(); String dest = resp.encodeRedirectURL(req.getContextPath() + "/curator/report/report.html"); testInstance.getDownloadRendering(req, resp, "report", FileFactory.HTML_FORMAT, dest); assertTrue(resp.containsHeader("Content-Disposition")); assertEquals(resp.getContentAsString(), expectedHTMLOutput); } catch(Exception e) { fail(e.getMessage()); } }