Code example for URI

Methods: getFragmentgetQuery

        assertEquals("", uri.getPath());
        assertEquals("query", uri.getQuery());
    public void testFragmentOnly() throws Exception { 
        URI uri = new URI("http://host#fragment");
        assertEquals("host", uri.getHost());
        assertEquals("", uri.getPath());
        assertEquals(null, uri.getQuery());
        assertEquals("fragment", uri.getFragment());
    public void testAtSignInPath() throws Exception { 
        URI uri = new URI("http://host/file@foo");
        assertEquals("/file@foo", uri.getPath());
        assertEquals(null, uri.getUserInfo());
    public void testColonInPath() throws Exception { 
Connect your IDE to all the code out there  Get Codota for Java