Code example for URI

Methods: getAuthority, getFragment

0
        assertEquals("", uri.getPath());
        assertEquals("query", uri.getQuery());
    } 
 
    public void testEmptyAuthorityWithFragment() throws Exception { 
        URI uri = new URI("http://#fragment");
        assertEquals(null, uri.getAuthority());
        assertEquals("", uri.getPath());
        assertEquals("fragment", uri.getFragment());
    } 
 
    public void testEncodingConstructorsRefuseRelativePath() throws Exception { 
        try { 
            new URI("http", "host", "relative", null);
            fail();
        } catch (URISyntaxException expected) {
        } 
        try { 
            new URI("http", "host", "relative", null, null);
            fail();
        } catch (URISyntaxException expected) {