Code example for URI

Methods: getFragment, getPort

0
        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());
        assertEquals("fragment/path", uri.getFragment());
    } 
 
    public void testHashInFragment() throws Exception { 
        try { 
            // This is not consistent with java.net.URL 
            new URI("http://host/file#fragment#another");