void () { File file = tempDir.newFile("test.txt"); assertEquals(file.toURI(), FileUtil.fileToUri(file)); assertEquals(file, new File(FileUtil.fileToUri(file))); File dir = file.getParentFile(); assertEquals(StringUtil.trimTrailing(dir.toURI().toString(), '/'), FileUtil.fileToUri(dir).toString()); assertEquals(dir, new File(FileUtil.fileToUri(dir))); if (SystemInfo.isWindows) { File uncFile = new File(toLocalUncPath(file.getPath())); assertEquals(uncFile.toURI(), FileUtil.fileToUri(uncFile)); assertEquals(uncFile, new File(FileUtil.fileToUri(uncFile))); File uncDir = uncFile.getParentFile(); assertEquals(StringUtil.trimTrailing(uncDir.toURI().toString(), '/'), FileUtil.fileToUri(uncDir).toString()); assertEquals(uncDir, new File(FileUtil.fileToUri(uncDir))); } }