Code example for URI

Methods: getFragment, getQuery

0
        assertEquals("/file", uri.getPath());
        assertEquals("query:colon", uri.getQuery());
    } 
 
    public void testQuestionMarkInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment?query");
        assertEquals("/file", uri.getPath());
        assertEquals(null, uri.getQuery());
        assertEquals("fragment?query", uri.getFragment());
    } 
 
    public void testColonInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment:80");
        assertEquals("/file", uri.getPath());
        assertEquals(-1, uri.getPort());
        assertEquals("fragment:80", uri.getFragment());
    } 
 
    public void testSlashInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment/path");
        assertEquals("/file", uri.getPath());