Code example for URI

Methods: getAuthority

0
        assertEquals("/foo", uri.getPath());
        assertEquals("http:///foo", uri.toString());
    } 
 
    public void testHttpUrlExtraLeadingSlashes() throws Exception { 
        URI uri = new URI("http:////foo");
        assertEquals(null, uri.getAuthority());
        assertEquals("//foo", uri.getPath());
        assertEquals("http:////foo", uri.toString());
    } 
 
    public void testFileUrlRelativePath() throws Exception { 
        URI base = new URI("file:/a/b/c");
        assertEquals("file:/a/b/d", base.resolve("d").toString());
    } 
 
    public void testFileUrlDottedPath() throws Exception { 
        URI url = new URI("file:../a/b");
        assertTrue(url.isOpaque());
        assertNull(url.getPath());
    }