### Question:
CategoryPath implements Comparable<CategoryPath> { public List<String> asList() { if (isRoot()) { return new ArrayList<>(); } List<String> list = parent.asList(); list.add(name); return list; } private  CategoryPath();  CategoryPath(CategoryPath parent, String... subPathElements);  CategoryPath(CategoryPath parent, List<String> subPathElements);  CategoryPath(String path); static String escapeString(String nonEscapedString); static String unescapeString(String escapedString); boolean isRoot(); CategoryPath getParent(); String getName(); String getPath(); @Override boolean equals(Object obj); @Override int hashCode(); boolean isAncestorOrSelf(CategoryPath candidateAncestorPath); String[] getPathElements(); @Override int compareTo(CategoryPath other); @Override String toString(); List<String> asList(); String[] asArray(); static final char DELIMITER_CHAR; static final String DELIMITER_STRING; static final String ESCAPED_DELIMITER_STRING; static final CategoryPath ROOT; }### Answer:
@Test public void testToList() { CategoryPath path = new CategoryPath("/aaa/bbb/bob"); List<String> names = path.asList(); assertEquals("aaa", names.get(0)); assertEquals("bbb", names.get(1)); assertEquals("bob", names.get(2)); }