SchemaLocation { public static final SchemaLocation parseURI(String uri) { try { int hashmarkIdx = uri.indexOf("#"); if (hashmarkIdx > -1) { String rootDocumentURI; String rawPointer; if (hashmarkIdx == uri.length() - 1) { rootDocumentURI = uri; rawPointer = ""; } else { rootDocumentURI = uri.substring(0, hashmarkIdx); rawPointer = uri.substring(hashmarkIdx + 1); } URI documentURI = "".equals(rootDocumentURI) ? null : new URI(rootDocumentURI); return new SchemaLocation(documentURI, new JSONPointer(rawPointer).getRefTokens()); } else { return new SchemaLocation(new URI(uri), emptyList()); } } catch (URISyntaxException e) { throw new RuntimeException(e); } } 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(expected = NullPointerException.class) public void parseURI_null() { SchemaLocation.parseURI(null); }
@Test public void parseURI_noHashmark() { SchemaLocation actual = SchemaLocation.parseURI("http: assertEquals(new SchemaLocation(uri("http: }
@Test public void parseURI_emptyFragment() { SchemaLocation actual = SchemaLocation.parseURI("http: assertEquals(new SchemaLocation(uri("http: }
@Test public void parseURI_singleSegmentPointer() { SchemaLocation actual = SchemaLocation.parseURI("http: SchemaLocation expected = new SchemaLocation(uri("http: assertEquals(expected, actual); }
@Test public void parseURI_onlyPointer() { SchemaLocation actual = SchemaLocation.parseURI("#/key"); SchemaLocation expected = new SchemaLocation(null, new ArrayList<>(asList("key"))); assertEquals(expected, actual); }
@Test public void parseURI_multiSegmentPointer() { SchemaLocation actual = SchemaLocation.parseURI("http: assertEquals(new SchemaLocation(uri("http: }