@Test public void testCheckNotValidUrls() { assertFalse(UrlValidator.isValid("abc.hello")); assertFalse(UrlValidator.isValid(null)); assertFalse(UrlValidator.isValid("")); }
public static boolean isValid(String url) { if (url == null || url.isEmpty()) return false; try { new URL(url); return true; } catch (MalformedURLException e) { return false; } }
UrlValidator { public static boolean isValid(String url) { if (url == null || url.isEmpty()) return false; try { new URL(url); return true; } catch (MalformedURLException e) { return false; } } }
UrlValidator { public static boolean isValid(String url) { if (url == null || url.isEmpty()) return false; try { new URL(url); return true; } catch (MalformedURLException e) { return false; } }  }
UrlValidator { public static boolean isValid(String url) { if (url == null || url.isEmpty()) return false; try { new URL(url); return true; } catch (MalformedURLException e) { return false; } }  static boolean isValid(String url); static URI toUri(String url); static String base(URI uri); }
UrlValidator { public static boolean isValid(String url) { if (url == null || url.isEmpty()) return false; try { new URL(url); return true; } catch (MalformedURLException e) { return false; } }  static boolean isValid(String url); static URI toUri(String url); static String base(URI uri);  }