@Test public void test_valueOf_noHost() throws Exception {
  URL url=URL.valueOf("file:///home/user1/router.js");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertNull(url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("home/user1/router.js",url.getPath());
  assertEquals(0,url.getParameters().size());
  url=URL.valueOf("file://home/user1/router.js");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertEquals("home",url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("user1/router.js",url.getPath());
  assertEquals(0,url.getParameters().size());
  url=URL.valueOf("file:/home/user1/router.js");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertNull(url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("home/user1/router.js",url.getPath());
  assertEquals(0,url.getParameters().size());
  url=URL.valueOf("file:///d:/home/user1/router.js");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertNull(url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("d:/home/user1/router.js",url.getPath());
  assertEquals(0,url.getParameters().size());
  url=URL.valueOf("file:///home/user1/router.js?p1=v1&p2=v2");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertNull(url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("home/user1/router.js",url.getPath());
  assertEquals(2,url.getParameters().size());
  Map<String,String> params=new HashMap<String,String>();
  params.put("p1","v1");
  params.put("p2","v2");
  assertEquals(params,url.getParameters());
  url=URL.valueOf("file:/home/user1/router.js?p1=v1&p2=v2");
  assertEquals("file",url.getProtocol());
  assertNull(url.getUsername());
  assertNull(url.getPassword());
  assertNull(url.getHost());
  assertEquals(0,url.getPort());
  assertEquals("home/user1/router.js",url.getPath());
  assertEquals(2,url.getParameters().size());
  params=new HashMap<String,String>();
  params.put("p1","v1");
  params.put("p2","v2");
  assertEquals(params,url.getParameters());
}
