ApiUtils { public static String fixURIFragment(String uri) throws UnsupportedEncodingException { String[] parts = uri.split("#"); if (parts.length >1) { parts[parts.length - 1] = parts[parts.length - 1].replace("+", " "); parts[parts.length - 1] = URLEncoder.encode(parts[parts.length - 1], "UTF-8"); parts[parts.length - 1] = parts[parts.length - 1].replace("+", "%20"); parts[parts.length - 1] = parts[parts.length - 1].replace("%3A", ":"); } return String.join("#",parts); }  static Set<String> getUuidsParameterOrSelection(String[] uuids, String bucket, UserSession session); static String getInternalId(String uuidOrInternalId, Boolean approved); static String fixURIFragment(String uri); static AbstractMetadata getRecord(String uuidOrInternalId); static UserSession getUserSession(HttpSession httpSession); static ServiceContext createServiceContext(HttpServletRequest request); static ServiceContext createServiceContext(HttpServletRequest request, String iso3langCode); static long sizeOfDirectory(Path lDir); static Path downloadUrlInTemp(String url); static AbstractMetadata canEditRecord(String metadataUuid, HttpServletRequest request); static AbstractMetadata canReviewRecord(String metadataUuid, HttpServletRequest request); static AbstractMetadata canChangeStatusRecord(String metadataUuid, HttpServletRequest request); static AbstractMetadata canViewRecord(String metadataUuid, HttpServletRequest request); static void createFavicon(Image img, Path outFile);  }
@Test public void testFixURIFragment() throws Exception { String result; result = ApiUtils.fixURIFragment("http: Assert.assertEquals("http: result = ApiUtils.fixURIFragment("http: Assert.assertEquals("http: result = ApiUtils.fixURIFragment("http: Assert.assertEquals("http: result = ApiUtils.fixURIFragment("http: Assert.assertEquals("http: result = ApiUtils.fixURIFragment("http: Assert.assertEquals("http: }