ConfigurationChecker extends AbstractProcessor { @Override public Collection<Artifact> process(Collection<Artifact> intermediates) { LOGGER.debug("Check for unnecessary configuration configuration ..."); checkForUnnecessaryInformation(intermediates); LOGGER.debug("Check for unnecessary configuration configuration... done."); return intermediates; } ConfigurationChecker(IProcessingReporter reporter, Configuration config); @Override Collection<Artifact> process(Collection<Artifact> intermediates);  }
@Test public void testUnneccesaryRemoveArtifact() { List<ArtifactSelector> list = new ArrayList<>(); list.add(selector); config.setRemoveArtifact(list); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); checker.process(artifacts); List<ProcessingMessage> messageList = reporter.getProcessingReport().getMessageList(); assertThat(messageList).isNotEmpty(); assertThat(messageList.get(0).getMessageType()).isEqualTo(MessageType.UNNECESSARY_CONFIG); }
@Test public void testNeccesaryRemoveArtifact() throws IOException { List<ArtifactSelector> list = new ArrayList<>(); list.add(selector); artifacts.add(artifact); config.setRemoveArtifact(list); TemporaryFolder folder = new TemporaryFolder(); folder.create(); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); checker.process(artifacts); List<ProcessingMessage> messageList = reporter.getProcessingReport().getMessageList(); assertThat(messageList).isEmpty(); }
@Test public void testUnnecessaryOverride() { Map<ArtifactSelector, Artifact> override = new HashMap<>(); override.put(selector, null); config.setOverride(override); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isNotEmpty(); }
@Test public void testNecessaryOverride() { Map<ArtifactSelector, Artifact> override = new HashMap<>(); override.put(selector, null); config.setOverride(override); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); artifacts.add(this.artifact); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isEmpty(); }
@Test public void testUnnecessaryIgnoreForSourceResolving() { List<ArtifactSelector> ignoreForSourceResolving = new ArrayList<>(); ignoreForSourceResolving.add(selector); config.setIgnoreForSourceResolving(ignoreForSourceResolving); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isNotEmpty(); }
@Test public void testNecessarySetFinalLicense() { Map<ArtifactSelector, LicenseInformation> finalLicenses = new HashMap<>(); finalLicenses.put(selector, null); config.setFinalLicenses(finalLicenses); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); artifacts.add(this.artifact); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isEmpty(); }
@Test public void testUnnecessarySetFinalLicense() { Map<ArtifactSelector, LicenseInformation> finalLicenses = new HashMap<>(); finalLicenses.put(selector, null); config.setFinalLicenses(finalLicenses); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isNotEmpty(); }
@Test public void testNecessaryIgnoreForSourceResolving() { List<ArtifactSelector> ignoreForSourceResolving = new ArrayList<>(); ignoreForSourceResolving.add(selector); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); artifacts.add(this.artifact); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isEmpty(); }
@Test public void testUnnecessaryLicenseValidation() { List<ArtifactSelector> licenseValidation = new ArrayList<>(); licenseValidation.add(selector); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); artifacts.add(this.artifact); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isEmpty(); }
@Test public void testNecessaryLicenseValidation() { List<ArtifactSelector> licenseValidation = new ArrayList<>(); licenseValidation.add(selector); ConfigurationChecker checker = new ConfigurationChecker(reporter, config); artifacts.add(this.artifact); checker.process(artifacts); assertThat(reporter.getProcessingReport().getMessageList()).isEmpty(); }