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);  }
@Test public void testCheckValidUrls() { assertTrue(UrlValidator.isValid("https: assertTrue(UrlValidator.isValid("http: }
@Test public void testCheckNotValidUrls() { assertFalse(UrlValidator.isValid("abc.hello")); assertFalse(UrlValidator.isValid(null)); assertFalse(UrlValidator.isValid("")); }