### Question:
URLParser { public static Map<URLParts, String> splitURL(String URLString) { try { return splitURL(new URL(URLString)); } catch (MalformedURLException ex) { throw new RuntimeException(ex); } }  static URL toAbsolute(URL baseURL, String relative); static String toAbsolute(String base, String relative); static Map<URLParts, String> splitURL(String URLString); static Map<URLParts, String> splitURL(URL url); static String joinURL(Map<URLParts, String> urlParts); static Map<DomainParts, String> splitDomain(String domain);  }### Answer:
@Test public void testSplitURL_String() { logger.info("splitURL"); String URLString = "http: Map<URLParser.URLParts, String> expResult = new HashMap<>(); expResult.put(URLParser.URLParts.PROTOCOL, "http"); expResult.put(URLParser.URLParts.PATH, "/to/path/document"); expResult.put(URLParser.URLParts.HOST, "www.example.com"); expResult.put(URLParser.URLParts.PORT, "8080"); expResult.put(URLParser.URLParts.USERINFO, "user:password"); expResult.put(URLParser.URLParts.FILENAME, "/to/path/document?arg1=val1&arg2=val2"); expResult.put(URLParser.URLParts.QUERY, "arg1=val1&arg2=val2"); expResult.put(URLParser.URLParts.AUTHORITY, "user:password@www.example.com:8080"); expResult.put(URLParser.URLParts.REF, "part"); Map<URLParser.URLParts, String> result = URLParser.splitURL(URLString); assertEquals(expResult, result); }