@Test public void testMultipleInputFilesNotGiven() { QAvalidatorConfig config = new QAvalidatorConfig(); config.setAnalysisFilename(""); String filename = new QAvalidator().selectAnalysisFilename(config); assertThat(filename, is("src/qa/analysis.groovy")); }
protected String selectAnalysisFilename(QAvalidatorConfig config) { if (StringUtils.isNotBlank(config.getAnalysisFilename())) { if (FileSystemUtil.checkFileOrResourceExists(config.getAnalysisFilename())) { return config.getAnalysisFilename(); } else { throw new IllegalArgumentException("Can not find analysis file " + config.getAnalysisFilename()); } } else { return findFirstExistingDefault(); } }
QAvalidator { protected String selectAnalysisFilename(QAvalidatorConfig config) { if (StringUtils.isNotBlank(config.getAnalysisFilename())) { if (FileSystemUtil.checkFileOrResourceExists(config.getAnalysisFilename())) { return config.getAnalysisFilename(); } else { throw new IllegalArgumentException("Can not find analysis file " + config.getAnalysisFilename()); } } else { return findFirstExistingDefault(); } } }
QAvalidator { protected String selectAnalysisFilename(QAvalidatorConfig config) { if (StringUtils.isNotBlank(config.getAnalysisFilename())) { if (FileSystemUtil.checkFileOrResourceExists(config.getAnalysisFilename())) { return config.getAnalysisFilename(); } else { throw new IllegalArgumentException("Can not find analysis file " + config.getAnalysisFilename()); } } else { return findFirstExistingDefault(); } }  }
QAvalidator { protected String selectAnalysisFilename(QAvalidatorConfig config) { if (StringUtils.isNotBlank(config.getAnalysisFilename())) { if (FileSystemUtil.checkFileOrResourceExists(config.getAnalysisFilename())) { return config.getAnalysisFilename(); } else { throw new IllegalArgumentException("Can not find analysis file " + config.getAnalysisFilename()); } } else { return findFirstExistingDefault(); } }  @SuppressWarnings({"squid:S2221","squid:S1166"}) // catching Exception (instead of specific subtypes) because there could also be runtime exceptions. // Their messages will all be properly logged. QAvalidatorResult runAnalysis(QAvalidatorConfig config); }
QAvalidator { protected String selectAnalysisFilename(QAvalidatorConfig config) { if (StringUtils.isNotBlank(config.getAnalysisFilename())) { if (FileSystemUtil.checkFileOrResourceExists(config.getAnalysisFilename())) { return config.getAnalysisFilename(); } else { throw new IllegalArgumentException("Can not find analysis file " + config.getAnalysisFilename()); } } else { return findFirstExistingDefault(); } }  @SuppressWarnings({"squid:S2221","squid:S1166"}) // catching Exception (instead of specific subtypes) because there could also be runtime exceptions. // Their messages will all be properly logged. QAvalidatorResult runAnalysis(QAvalidatorConfig config);  }