### Question:
PathTree { static List<String> parseJsonPointer(String jsonPointer) { if (!jsonPointer.startsWith("/") && !jsonPointer.isEmpty()) { throw InvalidArgumentException.fromMessage("JSON pointer must be empty or start with forward slash (/) but got \"" + jsonPointer + "\""); } final int HONOR_ALL_DELIMITERS = -1; return Arrays.stream(jsonPointer.split("/", HONOR_ALL_DELIMITERS)) .map(s -> s.replace("~1", "/").replace("~0", "~")) .collect(toList()); } private  PathTree(PathTree parent, String name); @Override String toString();  }### Answer:
@Test void parseJsonPointer() { assertEquals(singletonList(""), PathTree.parseJsonPointer("")); assertEquals(Arrays.asList("", ""), PathTree.parseJsonPointer("/")); assertEquals(Arrays.asList("", "foo", ""), PathTree.parseJsonPointer("/foo/")); assertEquals(Arrays.asList("", "", ""), PathTree.parseJsonPointer(" }
@Test void nonEmptyPointersMustHaveLeadingSlash() { assertThrows(InvalidArgumentException.class, () -> PathTree.parseJsonPointer("foo")); }