### Question:
DependencyPath { DependencyPath getParentPath() { DependencyPath parent = new DependencyPath(root); for (int i = 0; i < path.size() - 1; i++) { parent.path.add(path.get(i)); } return parent; } DependencyPath(@Nullable Artifact root); @VisibleForTesting DependencyPath append(Dependency dependency); DependencyPath concat(DependencyPath childPath); int size(); Artifact getLeaf(); ImmutableList<String> getArtifactKeys(); Artifact get(int i); Dependency getDependency(int i); Artifact findExclusion(String groupId, String artifactId); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void testGetParentPath() { DependencyPath parent = pathNullRootFooBar.getParentPath(); DependencyPath expected = new DependencyPath(null).append(new Dependency(foo, "test", false)); Assert.assertEquals(expected, parent); }
@Test public void testGetParentPath_empty_nullRoot() { DependencyPath path = new DependencyPath(null); DependencyPath parent = path.getParentPath(); Assert.assertEquals(new DependencyPath(null), parent); }
@Test public void testGetParentPath_empty() { DependencyPath path = new DependencyPath(new DefaultArtifact("a:b:1")); DependencyPath parent = path.getParentPath(); Assert.assertEquals(new DependencyPath(new DefaultArtifact("a:b:1")), parent); }