SchemaLocation { @Override public String toString() { StringBuilder buffer = new StringBuilder(); if (rootDocumentURI != null) { buffer.append(rootDocumentURI.toString()); } if (buffer.length() == 0 || (buffer.charAt(buffer.length() - 1) != '#' && !(pointerToLocation.isEmpty()))) { buffer.append("#"); } pointerToLocation.stream() .map(JSONPointer::escape) .forEach(e -> buffer.append("/").append(e)); return buffer.toString(); } 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 toString_noURI() { SchemaLocation underTest = new SchemaLocation(null, asList("a", "b/b", "c~c")); assertEquals("#/a/b~1b/c~0c", underTest.toString()); }
@Test public void toString_uriWithTrailingHashmark() { SchemaLocation underTest = new SchemaLocation(uri("http: assertEquals("http: }
@Test public void toString_uriAndPointer() { SchemaLocation underTest = new SchemaLocation(uri("http: assertEquals("http: }
@Test public void toString_uri_noPointer() { SchemaLocation underTest = new SchemaLocation(uri("http: assertEquals("http: }