### Question:
URLnaming { public static String resolve(String baseUri, String relativeUri) { if ((baseUri == null) || (relativeUri == null)) return relativeUri; if (relativeUri.startsWith("file:")) return relativeUri; if (baseUri.startsWith("file:")) { try { URI uriRelative = URI.create(relativeUri); if (uriRelative.isAbsolute()) return relativeUri; } catch (Exception e) { } if ((!relativeUri.isEmpty()) && (relativeUri.charAt(0) == '#')) return baseUri + relativeUri; if ((!relativeUri.isEmpty()) && (relativeUri.charAt(0) == '/')) return relativeUri; baseUri = baseUri.replace("\\", "/"); int pos = baseUri.lastIndexOf('/'); if (pos > 0) { String baseDir = baseUri.substring(0, pos + 1); if (relativeUri.equals(".")) { return baseDir; } else { return baseDir + relativeUri; } } } try { URI relativeURI = URI.create(relativeUri); if (relativeURI.isAbsolute()) return relativeUri; URI baseURI = URI.create(baseUri); URI resolvedURI = baseURI.resolve(relativeURI); return resolvedURI.toASCIIString(); } catch (IllegalArgumentException e) { return relativeUri; } }  static String canonicalizeWrite(String location); static String canonicalizeUriString(String location); static String resolve(String baseUri, String relativeUri); static String resolveFile(String baseDir, String filepath);  }### Answer:
@Test public void testResolve() { testResolve("http: testResolve("http: testResolve("file:/test/me/", "wanna", "file:/test/me/wanna"); testResolve("file:/test/me/", "/wanna", "/wanna"); testResolve("file: testResolve("file: testResolve("file: testResolve("http: }