### Question:
UrlUtil { public static File getFile(final URL url) { requireNonNull(url, "url"); if (!url.getProtocol().equalsIgnoreCase(PROTOCOL_FILE)) throw new IllegalStateException("url does not reference a local file, i.e. it does not start with 'file:': " + url); try { return createFile(url.toURI()); } catch (final URISyntaxException e) { throw new RuntimeException(e); } } private  UrlUtil(); static URL canonicalizeURL(final URL url); static File getFile(final URL url); static URL appendEncodedPath(final URL url, final String path); static URL appendNonEncodedPath(final URL url, final String path); static final URI urlToUri(final URL url); static File getFileFromJarUrl(final URL url); static URL getFileUrlFromJarUrl(final URL url); static final String PROTOCOL_FILE; static final String PROTOCOL_JAR; }### Answer:
@Test public void getFile_url() throws Exception { logger.debug("[{}]getFile_url: entered.", Integer.toHexString(identityHashCode(this))); final File tmpDir = createTempDirectory(this.getClass().getSimpleName()); final File fileFromString = createFile(tmpDir, "#Cumbia"); if (!fileFromString.exists() && fileFromString.createNewFile()) System.out.println("File created: " + fileFromString.getCanonicalPath()); else System.out.println("File already existed: " + fileFromString.getCanonicalPath()); final URL url = new URL("file:" + tmpDir.getCanonicalPath() + "/" + "%23Cumbia"); final File file = UrlUtil.getFile(url); assertTrue("File does not exist: " + file.getCanonicalPath(), file.exists()); assertEquals(fileFromString, file); }