### Question:
DependencyConflict extends LinkageProblemCause { @Override public String toString() { return linkageProblem.describe(this); } DependencyConflict(
      LinkageProblem linkageProblem,
      DependencyPath pathToSelectedArtifact,
      DependencyPath pathToArtifactThruSource); DependencyPath getPathToArtifactThruSource(); DependencyPath getPathToSelectedArtifact(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void testToString_versionConflict_missingSymbol() { MethodSymbol methodSymbol = new MethodSymbol("foo.B", "equals", "(Lfoo/Object;)Z", false); SymbolNotFoundProblem symbolNotFound = new SymbolNotFoundProblem( new ClassFile(new ClassPathEntry(Paths.get("foo", "bar.jar")), "foo.A"), new ClassFile(new ClassPathEntry(Paths.get("foo", "bar.jar")), "foo.B"), methodSymbol); Artifact root = new DefaultArtifact("a:b:1"); Artifact foo = new DefaultArtifact("com.google:foo:1"); Artifact bar = new DefaultArtifact("com.google:foo:2"); DependencyPath selectedPath = new DependencyPath(root).append(new Dependency(foo, "compile", false)); DependencyPath unselectedPath = new DependencyPath(root).append(new Dependency(bar, "compile", false)); DependencyConflict dependencyConflict = new DependencyConflict(symbolNotFound, selectedPath, unselectedPath); assertEquals( "Dependency conflict: com.google:foo:1 does not " + "define " + methodSymbol + " but com.google:foo:2 defines it.\n" + " selected: a:b:jar:1 / com.google:foo:1 (compile)\n" + " unselected: a:b:jar:1 / com.google:foo:2 (compile)", dependencyConflict.toString()); }
@Test public void testToString_versionConflict_abstractMethod() { MethodSymbol methodSymbol = new MethodSymbol("foo.B", "equals", "(Lfoo/Object;)Z", false); AbstractMethodProblem abstractMethodProblem = new AbstractMethodProblem( new ClassFile(new ClassPathEntry(Paths.get("foo", "bar.jar")), "foo.A"), methodSymbol, new ClassFile(new ClassPathEntry(Paths.get("foo", "bar.jar")), "foo.B") ); Artifact root = new DefaultArtifact("a:b:1"); Artifact foo = new DefaultArtifact("com.google:foo:1"); Artifact bar = new DefaultArtifact("com.google:foo:2"); DependencyPath selectedPath = new DependencyPath(root).append(new Dependency(foo, "compile", false)); DependencyPath unselectedPath = new DependencyPath(root).append(new Dependency(bar, "compile", false)); DependencyConflict dependencyConflict = new DependencyConflict(abstractMethodProblem, selectedPath, unselectedPath); assertEquals( "Dependency conflict: com.google:foo:1 defines " + "incompatible version of foo.B" + " but com.google:foo:2 defines compatible one.\n" + " selected: a:b:jar:1 / com.google:foo:1 (compile)\n" + " unselected: a:b:jar:1 / com.google:foo:2 (compile)", dependencyConflict.toString()); }