Code example for URI

Methods: getAuthority

0
        URI uri = new URI("HTTP://host/path");
        assertEquals("HTTP", uri.getScheme());
    } 
 
    public void testEmptyAuthorityWithPath() throws Exception { 
        URI uri = new URI("http:///path");
        assertEquals(null, uri.getAuthority());
        assertEquals("/path", uri.getPath());
    } 
 
    public void testEmptyAuthorityWithQuery() throws Exception { 
        URI uri = new URI("http://?query");
        assertEquals(null, uri.getAuthority());
        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());