FolderResourceFactory extends ResourceFactory { public URL getUrl(String subResourcePath) { if (subResourcePath.startsWith("/")) { subResourcePath = subResourcePath.substring(1); } return resolveUrl(this.resourceId + subResourcePath); } FolderResourceFactory(String resourceId); URL getUrl(String subResourcePath); @Override String toString();  }
@Test public void testGetUrl_RootClasspathUrl_Slash() throws IOException { String url = new FolderResourceFactory("classpath:/").getUrl().toExternalForm(); assertNotNull(url); assertTrue(url.endsWith("/")); }
@Test public void testGetUrl_RootClasspathUrl_NoSlash() throws IOException { String url = new FolderResourceFactory("classpath:").getUrl().toExternalForm(); assertNotNull(url); assertTrue(url.endsWith("/")); }