ZapReportUtil { public static File saveXmlSpiderResults(ZapReport report) { return saveXmlSpiderResults(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 saveXmlSpiderResultsTest() throws IOException { File report = ZapReportUtil.saveXmlSpiderResults(zapReport, TEST_DIR); assertTrue(report.isFile()); assertEquals(report.getName(), "zapSpiderResults.xml"); String content = new String(Files.readAllBytes(report.toPath()), StandardCharsets.UTF_8); assertTrue(content.contains("<url>url1</url>")); assertTrue(content.contains("<url>url2</url>")); report.delete(); }
@Test public void saveXmlSpiderResultsInDefaultLocationTest() throws IOException { File report = ZapReportUtil.saveXmlSpiderResults(zapReport); assertTrue(report.isFile()); assertEquals(report.getName(), "zapSpiderResults.xml"); String content = new String(Files.readAllBytes(report.toPath()), StandardCharsets.UTF_8); assertTrue(content.contains("<url>url1</url>")); assertTrue(content.contains("<url>url2</url>")); report.delete(); }