### Question:
Path implements Iterable<String>, Serializable { public int length() { return elements.length; } Path();  Path(String pathStr); private  Path(String[] elements, String pathStr); Path getParent(); Path getSubPath(int fromPosition); Path getSubPath(int fromPosition, int length); int length(); Iterator<String> iterator(); Collection<String> getElements(); String getElement(int index); String getLastElement(); String toString(); String getPathString(); int hashCode(); boolean equals(Object obj); static Path parse(String pathStr); static String getPathString(Path path); static Path concat(Path... paths); static String toPathString(List<String> listOfStrings); static String toPathString(String[] strings); static final String THIS_PATH_ELEMENT; static final String PATH_SEPARATOR; static final char PATH_SEPARATOR_CHAR; }### Answer:
@Test public void length() { Path p = new Path("this.a.b.c"); assertEquals("pM.length()", 3, p.length()); p = new Path("this.a.b"); assertEquals("pM.length()", 2, p.length()); p = new Path("this.a"); assertEquals("pM.length()", 1, p.length()); p = new Path("this"); assertEquals("pM.length()", 0, p.length()); p = new Path("a.b.c"); assertEquals("pM.length()", 3, p.length()); p = new Path("a.b"); assertEquals("pM.length()", 2, p.length()); p = new Path("a"); assertEquals("pM.length()", 1, p.length()); }