@Test
public void convertStringToURL() throws Exception {

	handlesResourceUrl();
	try {
		assertNull(FileSystem.convertStringToURL(null, true));
		assertNull(FileSystem.convertStringToURL("", true));  //$NON-NLS-1$
		assertNull(FileSystem.convertStringToURL(null, false));
		assertNull(FileSystem.convertStringToURL("", false));  //$NON-NLS-1$

		URL rr = FileSystem.convertStringToURL("file://marbre.jpg", false);  //$NON-NLS-1$
		assertNotNull(rr);
		assertEquals("file", rr.getProtocol());  //$NON-NLS-1$
		assertEquals("", rr.getAuthority()); //$NON-NLS-1$
		assertEquals("", rr.getHost());  //$NON-NLS-1$
		assertNull(rr.getQuery());
		assertEquals("marbre.jpg", rr.getPath());  //$NON-NLS-1$

		assertEquals(new URL("http", "www.arakhne.org", "/"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("http://www.arakhne.org/", true));  //$NON-NLS-1$
		assertEquals(new URL("http", "www.arakhne.org", "/"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("http://www.arakhne.org/", false));  //$NON-NLS-1$

		// CAUTION: testing right-formed jar URL.
		assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties", true));  //$NON-NLS-1$
		assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties", false));  //$NON-NLS-1$

		// CAUTION: testing malformed jar URL. Right syntax is: jar:{url}!/{entry}
		assertEquals(new URL("file", "", "/home/test/j.jar"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:/home/test/j.jar", true));  //$NON-NLS-1$
		assertEquals(new URL("file", "", "/home/test/j.jar"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:/home/test/j.jar", false));  //$NON-NLS-1$

		// CAUTION: testing malformed jar URL. Right syntax is: jar:{url}!/{entry}
		assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties", true));  //$NON-NLS-1$
		assertEquals(new URL("jar", "", "file:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties"),    //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("jar:/home/test/j.jar!/org/arakhne/afc/vmutil/ff.properties", false));  //$NON-NLS-1$

		URL testResource = Resources.getResource("/org/arakhne/afc/vmutil/test.txt");  //$NON-NLS-1$
		assertNotNull(testResource);

		assertEquals(testResource,
				FileSystem.convertStringToURL("resource:/org/arakhne/afc/vmutil/test.txt", true));  //$NON-NLS-1$
		assertEquals(null,
				FileSystem.convertStringToURL("resource:/org/arakhne/afc/vmutil/test.txt", false));  //$NON-NLS-1$

		assertEquals(testResource,
				FileSystem.convertStringToURL("resource:org/arakhne/afc/vmutil/test.txt", true));  //$NON-NLS-1$
		assertEquals(null,
				FileSystem.convertStringToURL("resource:org/arakhne/afc/vmutil/test.txt", false));  //$NON-NLS-1$

		assertEquals(testResource,
				FileSystem.convertStringToURL("/org/arakhne/afc/vmutil/test.txt", true));  //$NON-NLS-1$
		assertEquals(new URL("file", "", "/org/arakhne/afc/vmutil/test.txt"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("/org/arakhne/afc/vmutil/test.txt", false));  //$NON-NLS-1$

		assertEquals(testResource,
				FileSystem.convertStringToURL("org/arakhne/afc/vmutil/test.txt", true));  //$NON-NLS-1$
		assertEquals(new URL("file","", "org/arakhne/afc/vmutil/test.txt"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
				FileSystem.convertStringToURL("org/arakhne/afc/vmutil/test.txt", false));  //$NON-NLS-1$
	} finally {
		unhandlesResourceUrl();
	}
}