Code example for URI

Methods: getAuthority, getPort, getUserInfo

0
        assertEquals("host", uri.getHost());
        assertEquals(8080, uri.getPort());
    } 
 
    public void testUserPasswordEmptyHostPort() throws Exception { 
        URI uri = new URI("http://user:password@:8080");
        assertEquals("user:password@:8080", uri.getAuthority());
        // from RI. this is curious 
        assertEquals(null, uri.getUserInfo());
        assertEquals(null, uri.getHost());
        assertEquals(-1, uri.getPort());
    } 
 
    public void testUserPasswordEmptyHostEmptyPort() throws Exception { 
        URI uri = new URI("http://user:password@:");
        assertEquals("user:password@:", uri.getAuthority());
        // from RI. this is curious 
        assertEquals(null, uri.getUserInfo());
        assertEquals(null, uri.getHost());
        assertEquals(-1, uri.getPort());
    }