### Question:
UrlUtil { public static UrlParts parseUrl(String theUrl) { String url = theUrl; UrlParts retVal = new UrlParts(); if (url.startsWith("http")) { if (url.startsWith("/")) { url = url.substring(1); } int qmIdx = url.indexOf('?'); if (qmIdx != -1) { retVal.setParams(defaultIfBlank(url.substring(qmIdx + 1), null)); url = url.substring(0, qmIdx); } IdDt id = new IdDt(url); retVal.setResourceType(id.getResourceType()); retVal.setResourceId(id.getIdPart()); retVal.setVersionId(id.getVersionIdPart()); return retVal; } int parsingStart = 0; if (url.length() > 2) { if (url.charAt(0) == '/') { if (Character.isLetter(url.charAt(1))) { parsingStart = 1; } } } if (url.length() > 1 && url.charAt(0) == '/' && Character.isLetter(url.charAt(1)) && url.contains("?")) { url = url.substring(1); } int nextStart = 0; boolean nextIsHistory = false; for (int idx = parsingStart; idx < url.length(); idx++) { char nextChar = url.charAt(idx); boolean atEnd = (idx + 1) == url.length(); if (nextChar == '?' || nextChar == '/' || atEnd) { int endIdx = (atEnd && nextChar != '?') ? idx + 1 : idx; String nextSubstring = url.substring(nextStart, endIdx); if (retVal.getResourceType() == null) { retVal.setResourceType(nextSubstring); } else if (retVal.getResourceId() == null) { retVal.setResourceId(nextSubstring); } else if (nextIsHistory) { retVal.setVersionId(nextSubstring); } else { if (nextSubstring.equals(Constants.URL_TOKEN_HISTORY)) { nextIsHistory = true; } else { throw new InvalidRequestException("Invalid FHIR resource URL: " + url); } } if (nextChar == '?') { if (url.length() > idx + 1) { retVal.setParams(url.substring(idx + 1)); } break; } nextStart = idx + 1; } } return retVal; }  static String constructAbsoluteUrl(String theBase, String theEndpoint); static String constructRelativeUrl(String theParentExtensionUrl, String theExtensionUrl); static String escapeUrlParam(String theUnescaped); static boolean isAbsolute(String theValue); static boolean isNeedsSanitization(CharSequence theString); static boolean isValid(String theUrl); static RuntimeResourceDefinition parseUrlResourceType(FhirContext theCtx, String theUrl); static Map<String, String[]> parseQueryString(String theQueryString); static Map<String, String[]> parseQueryStrings(String... theQueryString); static UrlParts parseUrl(String theUrl); static String sanitizeUrlPart(IPrimitiveType<?> theString); static String sanitizeUrlPart(CharSequence theString); static String[] sanitizeUrlPart(String[] theParameterValues); static String unescape(String theString); static List<NameValuePair> translateMatchUrl(String theMatchUrl);  }### Answer:
@Test public void testParseUrl() { assertEquals("ConceptMap", UrlUtil.parseUrl("http: assertEquals("ConceptMap", UrlUtil.parseUrl("http: assertEquals("ussgfht-loincde", UrlUtil.parseUrl("http: assertEquals(null, UrlUtil.parseUrl("http: assertEquals("a=b", UrlUtil.parseUrl("http: assertEquals("a=b", UrlUtil.parseUrl("ConceptMap/ussgfht-loincde?a=b").getParams()); assertEquals("a=b", UrlUtil.parseUrl("/ConceptMap?a=b").getParams()); assertEquals("a=b", UrlUtil.parseUrl("/ConceptMap/ussgfht-loincde?a=b").getParams()); }