### Question:
Path implements Iterable<String>, Serializable { public Path getSubPath(int fromPosition) throws IllegalArgumentException { int length = this.length() - fromPosition; return this.getSubPath(fromPosition, 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 getSubPath() { Path p = new Path("this.a.b.c"); Path subpath = p.getSubPath(0, 0); assertEquals("subpath.toString()", "this", subpath.toString()); subpath = p.getSubPath(0, 1); assertEquals("subpath.toString()", "this.a", subpath.toString()); subpath = p.getSubPath(0, 2); assertEquals("subpath.toString()", "this.a.b", subpath.toString()); subpath = p.getSubPath(0, 3); assertEquals("subpath.toString()", "this.a.b.c", subpath.toString()); subpath = p.getSubPath(1, 2); assertEquals("subpath.toString()", "b.c", subpath.toString()); subpath = p.getSubPath(2, 1); assertEquals("subpath.toString()", "c", subpath.toString()); try { p.getSubPath(0, -1); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException ex) { } try { p.getSubPath(0, 5); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException ex) { } }