### Question:
ContentResolver { public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } } ContentResolver();  ContentResolver(JsonFactory jsonFactory); JsonNode resolve(URI uri);  }### Answer:
@Test(expected=IllegalArgumentException.class) public void wrongProtocolCausesIllegalArgumentException() { URI uriWithUnrecognisedProtocol = URI.create("foobar: resolver.resolve(uriWithUnrecognisedProtocol); }
@Test public void fileLinkIsResolvedToContent() throws IOException { URI schemaFile = createSchemaFile(); JsonNode uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("type").asText(), is(equalTo("string"))); }
@Test public void classpathLinkIsResolvedToContent() { URI schemaFile; JsonNode uriContent; schemaFile = URI.create("classpath:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("classpath:/schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("resource:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("java:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); }