@Test
public void parseQueryString() throws Exception {

    URL url0 = URLParser.parse("http://www.google.com?");
    Assert.assertEquals("http", url0.getProtocol());
    Assert.assertNull(url0.getUsername());
    Assert.assertNull(url0.getPassword());
    Assert.assertEquals("www.google.com", url0.getHost());
    Assert.assertNull(url0.getPort());
    Assert.assertNull(url0.getPath());
    url0 = URLParser.parse("http://www.google.com/?");
    Assert.assertEquals("http", url0.getProtocol());
    Assert.assertNull(url0.getUsername());
    Assert.assertNull(url0.getPassword());
    Assert.assertEquals("www.google.com", url0.getHost());
    Assert.assertNull(url0.getPort());
    Assert.assertEquals("/", url0.getPath());
    url0 = URLParser.parse("http://www.google.com/?x=1");
    Assert.assertEquals("http", url0.getProtocol());
    Assert.assertNull(url0.getUsername());
    Assert.assertNull(url0.getPassword());
    Assert.assertEquals("www.google.com", url0.getHost());
    Assert.assertNull(url0.getPort());
    Assert.assertEquals("/", url0.getPath());
    Assert.assertEquals("1", url0.getQueryProperty("x"));
    url0 = URLParser.parse("http://www.google.com/?x=1&y=2");
    Assert.assertEquals("http", url0.getProtocol());
    Assert.assertNull(url0.getUsername());
    Assert.assertNull(url0.getPassword());
    Assert.assertEquals("www.google.com", url0.getHost());
    Assert.assertNull(url0.getPort());
    Assert.assertEquals("/", url0.getPath());
    Assert.assertEquals("1", url0.getQueryProperty("x"));
    Assert.assertEquals("2", url0.getQueryProperty("y"));
    url0 = URLParser.parse("http://www.google.com/?x=%40&y=2");
    Assert.assertEquals("http", url0.getProtocol());
    Assert.assertNull(url0.getUsername());
    Assert.assertNull(url0.getPassword());
    Assert.assertEquals("www.google.com", url0.getHost());
    Assert.assertNull(url0.getPort());
    Assert.assertEquals("/", url0.getPath());
    Assert.assertEquals("@", url0.getQueryProperty("x"));
    Assert.assertEquals("2", url0.getQueryProperty("y"));
}