@Test public void isValidSearchQueryUrl() { assertTrue(UrlUtils.isValidSearchQueryUrl("https: assertTrue(UrlUtils.isValidSearchQueryUrl("http: assertTrue(UrlUtils.isValidSearchQueryUrl("http-test-site.com/search/?q=%s")); assertFalse(UrlUtils.isValidSearchQueryUrl("httpss: assertTrue(UrlUtils.isValidSearchQueryUrl("example.com/search/?q=%s")); assertTrue(UrlUtils.isValidSearchQueryUrl(" example.com/search/?q=%s ")); assertFalse(UrlUtils.isValidSearchQueryUrl("htps: }
public static boolean isValidSearchQueryUrl(String url) { String trimmedUrl = url.trim(); if (!trimmedUrl.matches("^.+?: trimmedUrl = "http: } final boolean isNetworkUrl = URLUtil.isNetworkUrl(trimmedUrl); final boolean containsToken = trimmedUrl.contains("%s"); return isNetworkUrl && containsToken; }
UrlUtils { public static boolean isValidSearchQueryUrl(String url) { String trimmedUrl = url.trim(); if (!trimmedUrl.matches("^.+?: trimmedUrl = "http: } final boolean isNetworkUrl = URLUtil.isNetworkUrl(trimmedUrl); final boolean containsToken = trimmedUrl.contains("%s"); return isNetworkUrl && containsToken; } }
UrlUtils { public static boolean isValidSearchQueryUrl(String url) { String trimmedUrl = url.trim(); if (!trimmedUrl.matches("^.+?: trimmedUrl = "http: } final boolean isNetworkUrl = URLUtil.isNetworkUrl(trimmedUrl); final boolean containsToken = trimmedUrl.contains("%s"); return isNetworkUrl && containsToken; }  }
UrlUtils { public static boolean isValidSearchQueryUrl(String url) { String trimmedUrl = url.trim(); if (!trimmedUrl.matches("^.+?: trimmedUrl = "http: } final boolean isNetworkUrl = URLUtil.isNetworkUrl(trimmedUrl); final boolean containsToken = trimmedUrl.contains("%s"); return isNetworkUrl && containsToken; }  static String normalize(@NonNull String input); static boolean isUrl(String url); static boolean isValidSearchQueryUrl(String url); static boolean isHttpOrHttps(String url); static String createSearchUrl(Context context, String searchTerm); static String stripUserInfo(@Nullable String url); static boolean isPermittedResourceProtocol(@Nullable final String scheme); static boolean isSupportedProtocol(@Nullable final String scheme); static boolean isInternalErrorURL(final String url); static boolean urlsMatchExceptForTrailingSlash(final String url1, final String url2); static String stripCommonSubdomains(@Nullable String host); static String stripScheme(@Nullable String url); static String stripSchemeAndSubDomain(String url); static boolean isLocalizedContent(@Nullable String url); }
UrlUtils { public static boolean isValidSearchQueryUrl(String url) { String trimmedUrl = url.trim(); if (!trimmedUrl.matches("^.+?: trimmedUrl = "http: } final boolean isNetworkUrl = URLUtil.isNetworkUrl(trimmedUrl); final boolean containsToken = trimmedUrl.contains("%s"); return isNetworkUrl && containsToken; }  static String normalize(@NonNull String input); static boolean isUrl(String url); static boolean isValidSearchQueryUrl(String url); static boolean isHttpOrHttps(String url); static String createSearchUrl(Context context, String searchTerm); static String stripUserInfo(@Nullable String url); static boolean isPermittedResourceProtocol(@Nullable final String scheme); static boolean isSupportedProtocol(@Nullable final String scheme); static boolean isInternalErrorURL(final String url); static boolean urlsMatchExceptForTrailingSlash(final String url1, final String url2); static String stripCommonSubdomains(@Nullable String host); static String stripScheme(@Nullable String url); static String stripSchemeAndSubDomain(String url); static boolean isLocalizedContent(@Nullable String url);  }