Code example for URI

Methods: getAuthority, getPort, getUserInfo

0
        assertEquals("user", uri.getUserInfo());
        assertEquals("host", uri.getHost());
    } 
 
    public void testUserNoPasswordExplicitPort() throws Exception { 
        URI uri = new URI("http://user@host:8080");
        assertEquals("user@host:8080", uri.getAuthority());
        assertEquals("user", uri.getUserInfo());
        assertEquals("host", uri.getHost());
        assertEquals(8080, uri.getPort());
    } 
 
    public void testUserPasswordHostPort() throws Exception { 
        URI uri = new URI("http://user:password@host:8080");
        assertEquals("user:password@host:8080", uri.getAuthority());
        assertEquals("user:password", uri.getUserInfo());
        assertEquals("host", uri.getHost());
        assertEquals(8080, uri.getPort());
    } 
 
    public void testUserPasswordEmptyHostPort() throws Exception {