@Test public void testFormatDependencyPaths_onePath() { ImmutableListMultimap<ClassPathEntry, DependencyPath> tree = ImmutableListMultimap.of(jarA, dependencyPath_A, jarB, dependencyPath_B); ClassPathResult classPathResult = new ClassPathResult(tree, ImmutableSet.of()); String actual = classPathResult.formatDependencyPaths(ImmutableList.of(jarA)); assertEquals("com.google:a:1 is at:\n" + " com.google:a:1 (compile)\n", actual); }
public String formatDependencyPaths(Iterable<ClassPathEntry> entries) { StringBuilder message = new StringBuilder(); for (ClassPathEntry entry : entries) { ImmutableList<DependencyPath> dependencyPaths = getDependencyPaths(entry); checkArgument(dependencyPaths.size() >= 1, "%s is not in the class path", entry); message.append(entry + " is at:\n"); int otherCount = dependencyPaths.size() - 1; message.append(" " + dependencyPaths.get(0) + "\n"); if (otherCount == 1) { message.append(" and 1 dependency path.\n"); } else if (otherCount > 1) { message.append(" and " + otherCount + " other dependency paths.\n"); } } return message.toString(); }
ClassPathResult { public String formatDependencyPaths(Iterable<ClassPathEntry> entries) { StringBuilder message = new StringBuilder(); for (ClassPathEntry entry : entries) { ImmutableList<DependencyPath> dependencyPaths = getDependencyPaths(entry); checkArgument(dependencyPaths.size() >= 1, "%s is not in the class path", entry); message.append(entry + " is at:\n"); int otherCount = dependencyPaths.size() - 1; message.append(" " + dependencyPaths.get(0) + "\n"); if (otherCount == 1) { message.append(" and 1 dependency path.\n"); } else if (otherCount > 1) { message.append(" and " + otherCount + " other dependency paths.\n"); } } return message.toString(); } }
ClassPathResult { public String formatDependencyPaths(Iterable<ClassPathEntry> entries) { StringBuilder message = new StringBuilder(); for (ClassPathEntry entry : entries) { ImmutableList<DependencyPath> dependencyPaths = getDependencyPaths(entry); checkArgument(dependencyPaths.size() >= 1, "%s is not in the class path", entry); message.append(entry + " is at:\n"); int otherCount = dependencyPaths.size() - 1; message.append(" " + dependencyPaths.get(0) + "\n"); if (otherCount == 1) { message.append(" and 1 dependency path.\n"); } else if (otherCount > 1) { message.append(" and " + otherCount + " other dependency paths.\n"); } } return message.toString(); } ClassPathResult(
      ListMultimap<ClassPathEntry, DependencyPath> dependencyPaths,
      Iterable<UnresolvableArtifactProblem> artifactProblems); }
ClassPathResult { public String formatDependencyPaths(Iterable<ClassPathEntry> entries) { StringBuilder message = new StringBuilder(); for (ClassPathEntry entry : entries) { ImmutableList<DependencyPath> dependencyPaths = getDependencyPaths(entry); checkArgument(dependencyPaths.size() >= 1, "%s is not in the class path", entry); message.append(entry + " is at:\n"); int otherCount = dependencyPaths.size() - 1; message.append(" " + dependencyPaths.get(0) + "\n"); if (otherCount == 1) { message.append(" and 1 dependency path.\n"); } else if (otherCount > 1) { message.append(" and " + otherCount + " other dependency paths.\n"); } } return message.toString(); } ClassPathResult(
      ListMultimap<ClassPathEntry, DependencyPath> dependencyPaths,
      Iterable<UnresolvableArtifactProblem> artifactProblems); ImmutableList<ClassPathEntry> getClassPath(); ImmutableList<DependencyPath> getDependencyPaths(ClassPathEntry entry); ImmutableList<UnresolvableArtifactProblem> getArtifactProblems(); String formatDependencyPaths(Iterable<ClassPathEntry> entries); ImmutableSet<ClassPathEntry> getClassPathEntries(String coordinates); }
ClassPathResult { public String formatDependencyPaths(Iterable<ClassPathEntry> entries) { StringBuilder message = new StringBuilder(); for (ClassPathEntry entry : entries) { ImmutableList<DependencyPath> dependencyPaths = getDependencyPaths(entry); checkArgument(dependencyPaths.size() >= 1, "%s is not in the class path", entry); message.append(entry + " is at:\n"); int otherCount = dependencyPaths.size() - 1; message.append(" " + dependencyPaths.get(0) + "\n"); if (otherCount == 1) { message.append(" and 1 dependency path.\n"); } else if (otherCount > 1) { message.append(" and " + otherCount + " other dependency paths.\n"); } } return message.toString(); } ClassPathResult(
      ListMultimap<ClassPathEntry, DependencyPath> dependencyPaths,
      Iterable<UnresolvableArtifactProblem> artifactProblems); ImmutableList<ClassPathEntry> getClassPath(); ImmutableList<DependencyPath> getDependencyPaths(ClassPathEntry entry); ImmutableList<UnresolvableArtifactProblem> getArtifactProblems(); String formatDependencyPaths(Iterable<ClassPathEntry> entries); ImmutableSet<ClassPathEntry> getClassPathEntries(String coordinates);  }