Code example for URI

Methods: getAuthority, getPort, getUserInfo

0
        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());
    } 
 
    public void testPathOnly() throws Exception { 
        URI uri = new URI("http://host/path");
        assertEquals("host", uri.getHost());
        assertEquals("/path", uri.getPath());
    } 
 
    public void testQueryOnly() throws Exception { 
        URI uri = new URI("http://host?query");