### Question:
ExcludedDependency extends MissingDependency { @Override public String toString() { Artifact artifactContainingValidSymbol = pathToMissingArtifact.getLeaf(); return "The valid symbol is in " + artifactContainingValidSymbol + " at " + pathToMissingArtifact + " but it was not selected because " + Artifacts.toCoordinates(excludingArtifact) + " excludes " + Artifacts.makeKey(artifactContainingValidSymbol) + "."; } ExcludedDependency(DependencyPath pathToMissingArtifact, Artifact excludingArtifact); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void testToString() { Artifact root = new DefaultArtifact("a:b:1"); Artifact foo = new DefaultArtifact("com.google:foo:1"); Artifact bar = new DefaultArtifact("com.google:bar:1"); DependencyPath pathRootFooBar = new DependencyPath(root) .append(new Dependency(foo, "test", false)) .append(new Dependency(bar, "compile", true)); ExcludedDependency cause = new ExcludedDependency(pathRootFooBar, foo); assertEquals( "The valid symbol is in com.google:bar:jar:1 at a:b:jar:1 / " + "com.google:foo:1 (test) / com.google:bar:1 (compile, optional) " + "but it was not selected because com.google:foo:1 excludes com.google:bar.", cause.toString()); }