### Question:
CategoryPath implements Comparable<CategoryPath> { public CategoryPath getParent() { if (parentPath.length() == 0 && name.length() == 0) { return null; } return new CategoryPath(parentPath); } CategoryPath(String path);  CategoryPath(CategoryPath parent, String name); boolean isRoot(); String getName(); String getPath(); CategoryPath getParent(); @Override boolean equals(Object obj); @Override int hashCode(); boolean isAncestorOrSelf(CategoryPath categoryPath); String[] getPathElements(); @Override int compareTo(CategoryPath otherPath); @Override String toString(); static final char DELIMITER_CHAR; static final String DELIMITER_STRING; static final CategoryPath ROOT; }### Answer:
@Test public void testGetParent() { CategoryPath c = new CategoryPath(null); assertNull(c.getParent()); c = new CategoryPath("/aaa/bbb/ccc"); c = c.getParent(); Assert.assertEquals("/aaa/bbb", c.getPath()); }