@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()); }
public CategoryPath getParent() { if (parentPath.length() == 0 && name.length() == 0) { return null; } return new CategoryPath(parentPath); }
CategoryPath implements Comparable<CategoryPath> { public CategoryPath getParent() { if (parentPath.length() == 0 && name.length() == 0) { return null; } return new CategoryPath(parentPath); } }
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); }
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(); }
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; }