PromotionReportView extends View { public void compute() { final Comparator<String> promotionPlanComparator = new PromotionPlanComparator(dependencyReports); Collections.sort(unPromotedDependencies, promotionPlanComparator); for (final PromotionReportView promotionReport : getAllDependencyReport()) { final Module module = promotionReport.getRootModule(); if(null == module) { LOG.warn("No root module found. Aborting compute()."); return; } final List<String> versions = mismatchVersions.get(module.getName()); if (versions == null) { mismatchVersions.put(module.getName(), Lists.newArrayList(module.getVersion())); } else if (!versions.contains(module.getVersion())) { versions.add(module.getVersion()); } } final Iterator<String> moduleNames = mismatchVersions.keySet().iterator(); while (moduleNames.hasNext()) { final String moduleName = moduleNames.next(); final List<String> versions = mismatchVersions.get(moduleName); if (versions.size() == 1) { moduleNames.remove(); } } } PromotionReportView(); Module getRootModule(); void setRootModule(final Module rootModule); void addUnPromotedDependency(final String dependencyId); List<String> getUnPromotedDependencies(); void addDependencyPromotionReport(final String moduleId, final PromotionReportView report); PromotionReportView getTargetedDependencyReport(final String moduleId); Map<Artifact, Comment> getDoNotUseArtifacts(); void addDoNotUseArtifact(final Artifact doNotUseArtifact, final Comment comment); List<PromotionReportView> getReportsWithDoNotUseArtifacts(); boolean isSnapshot(); Set<String> getMisMatchModules(); List<String> getMisMatchVersions(final String moduleName); void compute(); List<String> getPromotionPlan(); List<Artifact> getMissingLicenses(); void addMissingThirdPartyDependencyLicenses(final Artifact dependency); Map<String, String> getDependenciesWithNotAcceptedLicenses(); void addUnacceptedLicenseEntry(final String artifact, final String license); String getArtifactLink(final String gavc);  }
@Test public void testNullRootModuleIsNPESafe() { PromotionReportView sut = new PromotionReportView(); sut.compute(); }