@Test public void should_ignore_xml_report_when_property_is_not_set() { File reportFile = configuration.dumpXmlReport(new Report()); assertThat(reportFile).isNull(); verifyZeroInteractions(fs); }
public File dumpXmlReport(Report report) { if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { return null; } try { String reportAsString = reportToString(report); File reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); LOG.info("PMD output report: " + reportFile.getAbsolutePath()); return reportFile; } catch (IOException e) { throw new IllegalStateException("Fail to save the PMD report", e); } }
PmdConfiguration implements BatchExtension { public File dumpXmlReport(Report report) { if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { return null; } try { String reportAsString = reportToString(report); File reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); LOG.info("PMD output report: " + reportFile.getAbsolutePath()); return reportFile; } catch (IOException e) { throw new IllegalStateException("Fail to save the PMD report", e); } } }
PmdConfiguration implements BatchExtension { public File dumpXmlReport(Report report) { if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { return null; } try { String reportAsString = reportToString(report); File reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); LOG.info("PMD output report: " + reportFile.getAbsolutePath()); return reportFile; } catch (IOException e) { throw new IllegalStateException("Fail to save the PMD report", e); } } PmdConfiguration(FileSystem fileSystem, Settings settings); }
PmdConfiguration implements BatchExtension { public File dumpXmlReport(Report report) { if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { return null; } try { String reportAsString = reportToString(report); File reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); LOG.info("PMD output report: " + reportFile.getAbsolutePath()); return reportFile; } catch (IOException e) { throw new IllegalStateException("Fail to save the PMD report", e); } } PmdConfiguration(FileSystem fileSystem, Settings settings); File dumpXmlRuleSet(String repositoryKey, String rulesXml); File dumpXmlReport(Report report); }
PmdConfiguration implements BatchExtension { public File dumpXmlReport(Report report) { if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { return null; } try { String reportAsString = reportToString(report); File reportFile = writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); LOG.info("PMD output report: " + reportFile.getAbsolutePath()); return reportFile; } catch (IOException e) { throw new IllegalStateException("Fail to save the PMD report", e); } } PmdConfiguration(FileSystem fileSystem, Settings settings); File dumpXmlRuleSet(String repositoryKey, String rulesXml); File dumpXmlReport(Report report); static final String PROPERTY_GENERATE_XML; static final String PMD_RESULT_XML; }