ZapReportUtil { public static File saveHtmlSpiderResults(ZapReport report) { return saveHtmlSpiderResults(report, DEFAULT_REPORTS_PATH); } private  ZapReportUtil(); static void saveAllReports(ZapReport report); static void saveAllReports(ZapReport report, String path); static File saveHtmlReport(ZapReport report); static File saveHtmlReport(ZapReport report, String path); static File saveXmlReport(ZapReport report); static File saveXmlReport(ZapReport report, String path); static File saveHtmlSpiderResults(ZapReport report); static File saveHtmlSpiderResults(ZapReport report, String path); static File saveXmlSpiderResults(ZapReport report); static File saveXmlSpiderResults(ZapReport report, String path);  }
@Test public void saveHtmlSpiderResultsTest() throws IOException { File report = ZapReportUtil.saveHtmlSpiderResults(zapReport, TEST_DIR); assertTrue(report.isFile()); assertEquals(report.getName(), "zapSpiderResults.html"); String content = new String(Files.readAllBytes(report.toPath()), StandardCharsets.UTF_8); assertTrue(content.contains("<html>")); assertTrue(content.contains("url1")); assertTrue(content.contains("url2")); report.delete(); }
@Test public void saveHtmlSpiderResultsInDefaultLocationTest() throws IOException { File report = ZapReportUtil.saveHtmlSpiderResults(zapReport); assertTrue(report.isFile()); assertEquals(report.getName(), "zapSpiderResults.html"); String content = new String(Files.readAllBytes(report.toPath()), StandardCharsets.UTF_8); assertTrue(content.contains("<html>")); assertTrue(content.contains("url1")); assertTrue(content.contains("url2")); report.delete(); }