SchemaLocation { public SchemaLocation addPointerSegment(String key) { List<String> newPointer = new ArrayList<>(pointerToLocation.size() + 1); newPointer.addAll(pointerToLocation); newPointer.add(key); return new SchemaLocation(rootDocumentURI, newPointer); } SchemaLocation(URI rootDocumentURI, List<String> pointerToLocation);  SchemaLocation(List<String> pointerToLocation); static final SchemaLocation empty(); static final SchemaLocation parseURI(String uri); SchemaLocation addPointerSegment(String key); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void addPointerSegment() { SchemaLocation underTest = SchemaLocation.empty(); SchemaLocation actual = underTest.addPointerSegment("key"); assertEquals("#/key", actual.toString()); assertEquals("#", underTest.toString()); }