Code example for URI

Methods: getAuthority, getQuery

0
        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());
        assertEquals("fragment", uri.getFragment());
    } 
 
    public void testEncodingConstructorsRefuseRelativePath() throws Exception { 
        try { 
            new URI("http", "host", "relative", null);