### Question:
ClasspathResource implements Resource { @Override public URL url() { URL url = this.classLoader.getResource(this.path); if (url == null) { throw new RuntimeException(new FileNotFoundException(this.path)); } return url; } ClasspathResource(String path, Class<?> clazz);  ClasspathResource(String path, ClassLoader classLoader); @Override String path(); @Override URL url(); @Override String absolutePath(); @Override InputStream inputStream(); @Override ClassLoader classLoader(); @Override String toString(); static final String CLASSPATH_SCHEME; }### Answer:
@Test public void nonExistentResourceThrowsExceptionWhenTryingToGetURL() { ClasspathResource resource = new ClasspathResource("foobar", ClasspathResourceTest.class); Exception e = assertThrows(RuntimeException.class, () -> resource.url()); assertEquals("java.io.FileNotFoundException: foobar", e.getMessage()); }