AliasedDirectoryResource implements Resource { @Override public URL getResource(String location) { URL result = null; if (location.startsWith(alias)) { location = location.substring(alias.length()); File file = new File(rootDirectory, location); if (file.exists()) { try { result = file.toURI().toURL(); } catch (MalformedURLException exception) { } } } return result; } AliasedDirectoryResource();  AliasedDirectoryResource(File rootDirectory, String alias); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Stream<String> getAllLocations(); String getAlias(); File getRootDirectory(); void setAlias(String alias); void setRootDirectory(File rootDirectory);  }
@Test void testGetResource() { AliasedDirectoryResource resource = new AliasedDirectoryResource(null, "/alias"); assertNull(resource.getResource("resource")); }
@Test void testGetResource3() { AliasedDirectoryResource resource = new AliasedDirectoryResource(new File("src/test/java/org"), "/org"); assertNull(resource.getResource("/cloud/piranha/resource/AliasedDirectoryResourceTest2.java")); }