LinkBuilders { public static LinkBuilder parse( String url ) { Link link = Links.parse( url ); return new LinkBuilder( link.getUri(), link.getParameters() ); }  static LinkBuilder parse( String url );  }
@Test public void testParse() throws Exception { List<String> schemes = Lists.newArrayList( "http", "https" ); List<String> hosts = Lists.newArrayList( "cnn.com", "127.0.0.1" ); List<Integer> ports = Lists.newArrayList( -1, 80, 443, 9090, 12345 ); List<String> paths = Lists.newArrayList( "", "/", "/foo", "/foo/bar" ); List<String> queryDatas = Lists.newArrayList( "", "?", "?cat=dog", "?cat=dog&foo=bar", "?foo" ); for (String scheme : schemes) { for (String host : hosts) { for (int port : ports) { for (String path : paths) { for (String queryData : queryDatas) { String link = String.format( "%s: if ( port > 0 ) { link += ":" + port; } link += path; link += queryData; test( link ); } } } } } }