UriUtil { @VisibleForTesting @NonNull static String removeFragment(@NonNull String link) { return link.replaceFirst("#.*$", ""); } private  UriUtil(); @NonNull static String decodeURL(@NonNull String url); @NonNull static String encodeURL(@NonNull String url); @NonNull static String resolveProtocolRelativeUrl(@NonNull WikiSite wiki,
                                                             @NonNull String url); @NonNull static String resolveProtocolRelativeUrl(@NonNull String url); static boolean isValidPageLink(@NonNull Uri uri); static boolean isValidOfflinePageLink(@NonNull Uri uri); static String getUrlWithProvenance(Context context, PageTitle title,
                                              @StringRes int provId); @NonNull static String getTitleFromUrl(@NonNull String url); @NonNull static String getLanguageVariantFromUri(@NonNull Uri uri); @NonNull static String removeInternalLinkPrefix(@NonNull String link); static String getFragment(String link);  }
@Test public void testRemoveFragment() { assertThat(UriUtil.removeFragment(TITLE + "#" + LEGAL_FRAGMENT_CHARS), is(TITLE)); }
@Test public void testRemoveEmptyFragment() { assertThat(UriUtil.removeFragment(TITLE + "#"), is(TITLE)); }
@Test public void testRemoveFragmentWithHash() { assertThat(UriUtil.removeFragment(TITLE + "##"), is(TITLE)); }