### Question:
Canonicalization { public String canonicalize(String url) throws MalformedURLException { NormalizedUrl normalized = normalize(url); String host = normalized.host; host = host.replaceFirst("^\\.{1,}", ""); host = host.replaceFirst("\\.{1,}$", ""); host = host.replaceAll("\\.{2,}", ".").toLowerCase(); if (ipUtils.isIpAddress(host) && !ipUtils.isDecimalIpAddress(host)) { InetAddress inetAddr = ipUtils.toInetAddress(host); if (inetAddr != null) { host = inetAddr.getHostAddress(); } } String path = normalized.path; path = path.replaceAll("/\\./", "/").replaceAll("/\\w+/\\.\\./?", "/"); path = path.replaceAll("/{2,}", "/"); String full = normalized.url .replace(normalized.host, host) .replace(normalized.path, path); StringBuilder sb = new StringBuilder(); for (char ch : full.toCharArray()) { if (ch <= 32 || ch >= 127 || ch == '#' || ch == '%') { sb.append(percentEncoder.encode(Character.toString(ch)).toUpperCase()); } else { sb.append(ch); } } String escapedUrl = sb.toString(); return convertSlashHexSymbols(escapedUrl); }  String canonicalize(String url);  }### Answer:
@Test public void testCanonicalize() throws MalformedURLException, URISyntaxException, DecoderException { Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: "http: Assert.assertEquals( "http: canon.canonicalize( "http: Assert.assertEquals("http: "http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: "http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("http: Assert.assertEquals("https: Assert.assertEquals("http: Assert.assertEquals("http: "http: Assert.assertEquals("http: }