AssetsControllerHelper { public boolean isDirectoryURL(URL url) { try { return url.getProtocol().equals("file") && new File(url.toURI()).isDirectory(); } catch (URISyntaxException e) { logger.error("Could not URL convert to URI", e); } return false; }  String normalizePathWithoutLeadingSlash(String fileName, boolean enforceUnixSeparator); boolean isDirectoryURL(URL url);  }
@Test public void testIsDirectoryURLWithJarProtocol() throws Exception { boolean result = assetsControllerHelper.isDirectoryURL(new URL("jar:file:/home/ninja/ninja.jar!/")); assertThat(result, is(false)); }
@Test public void testIsDirectoryURLWithFile() throws Exception { boolean result = assetsControllerHelper.isDirectoryURL(this.getClass().getResource("/assets/testasset.txt")); assertThat(result, is(false)); }
@Test public void testIsDirectoryURLWithDirectory() throws Exception { boolean result = assetsControllerHelper.isDirectoryURL(this.getClass().getResource("/assets/assets/")); assertThat(result, is(true)); }
@Test public void testIsDirectoryURLWithDirectoryContainsSpecialCharacters() throws Exception { File dir = tempFolder.newFolder("a#b"); boolean result = assetsControllerHelper.isDirectoryURL(dir.toURI().toURL()); assertThat(result, is(true)); }