Code example for URI

Methods: resolve

0
        assertEquals("http://a/g", base.resolve("../../../g").toString()); // RI doesn't normalize
        assertEquals("http://a/g", base.resolve("../../../../g").toString()); // fails on RI
    } 
 
    public void testRfc1808AbnormalExampleRemoveDotSegments() throws Exception { 
        URI base = new URI("http://a/b/c/d;p?q");
        assertEquals("http://a/g", base.resolve("/./g").toString()); // RI doesn't normalize
        assertEquals("http://a/g", base.resolve("/../g").toString()); // fails on RI
        assertEquals("http://a/b/c/g.", base.resolve("g.").toString());
        assertEquals("http://a/b/c/.g", base.resolve(".g").toString());
        assertEquals("http://a/b/c/g..", base.resolve("g..").toString());
        assertEquals("http://a/b/c/..g", base.resolve("..g").toString());
    } 
 
    public void testRfc1808AbnormalExampleNonsensicalDots() throws Exception { 
        URI base = new URI("http://a/b/c/d;p?q");
        assertEquals("http://a/b/g", base.resolve("./../g").toString());
        assertEquals("http://a/b/c/g/", base.resolve("./g/.").toString());
        assertEquals("http://a/b/c/g/h", base.resolve("g/./h").toString());
        assertEquals("http://a/b/c/h", base.resolve("g/../h").toString());
        assertEquals("http://a/b/c/g;x=1/y", base.resolve("g;x=1/./y").toString());