Code example for URI

Methods: getFragment, getQuery

0
        assertEquals("", uri.getPath());
        assertEquals("query", uri.getQuery());
    } 
 
    public void testFragmentOnly() throws Exception { 
        URI uri = new URI("http://host#fragment");
        assertEquals("host", uri.getHost());
        assertEquals("", uri.getPath());
        assertEquals(null, uri.getQuery());
        assertEquals("fragment", uri.getFragment());
    } 
 
    public void testAtSignInPath() throws Exception { 
        URI uri = new URI("http://host/file@foo");
        assertEquals("/file@foo", uri.getPath());
        assertEquals(null, uri.getUserInfo());
    } 
 
 
    public void testColonInPath() throws Exception { 
        URI uri = new URI("http://host/file:colon");