FsHelper { @Deprecated public static URL createUrlFromString(String s) throws IOException, URISyntaxException { return createUrlFromString(s, false); }  static File toFile(String s); static File createFileReference(URL url); static File createFileReference(URL url, String charset); @Deprecated static URL createUrlFromString(String s); static URL createUrlFromString(String s, boolean backslashConvert); static FileFilter createFilter(String filterExpression, String filterImpl); static FileFilter logWarningIfRequired(FileFilter f); static File renameFile(File file, String suffix, FsWorker worker);  }
@Test public void testUnixStyleFullURI() throws Exception { assertNotNull(FsHelper.createUrlFromString("file: }
@Test public void testUnixStyleURI() throws Exception { URL url = FsHelper.createUrlFromString("/home/fred"); assertEquals("fred", new File(url.toURI()).getName()); }
@Test public void testWindowsFullURI() throws Exception { URL url = FsHelper.createUrlFromString("file: assertEquals("fred", new File(url.toURI()).getName()); }
@Test public void testFullURIWithColons() throws Exception { URL url = FsHelper.createUrlFromString("file: assertEquals("fred", new File(url.toURI()).getName()); }
@Test public void testCreateFileRefWithBackSlash() throws Exception { URL url = FsHelper.createUrlFromString("file: assertEquals("fred", new File(url.toURI()).getName()); }
@Test public void testWindowsURI() throws Exception { try { FsHelper.createUrlFromString("c:/home/fred"); } catch (IllegalArgumentException e) { } }
@Test public void testCreateUrlFromString() throws Exception { String urlString = "file: URL url = FsHelper.createUrlFromString(urlString, true); assertTrue("protocol", "file".equals(url.getProtocol())); assertTrue("path " + url.getPath(), "/c:/tmp/".equals(url.getPath())); String urlString2 = "file:/c:/tmp/"; URL url2 = FsHelper.createUrlFromString(urlString2, true); assertTrue("protocol", "file".equals(url2.getProtocol())); assertTrue("path " + url.getPath(), "/c:/tmp/".equals(url2.getPath())); String urlString3 = "../dir/"; URL url3 = FsHelper.createUrlFromString(urlString3, true); assertTrue("protocol", "file".equals(url3.getProtocol())); tryExpectingException(() -> { FsHelper.createUrlFromString("..\\dir\\"); }); tryExpectingException(() -> { FsHelper.createUrlFromString("c:\\dir\\"); }); tryExpectingException(() -> { FsHelper.createUrlFromString("http: }); tryExpectingException(() -> { FsHelper.createUrlFromString("file:\\\file\\"); }); tryExpectingException(() -> { FsHelper.createUrlFromString(null, true); }); }