@Test void UrlValidatorURISyntaxExceptionTest() { String url = "http: Assertions.assertThrows(InvalidURLException.class, () -> UrlValidator.isUrlValid(url)); }
public static boolean isUrlValid(String url) { try { new URL(url).toURI(); return true; } catch (MalformedURLException e) { throw new InvalidURLException(ErrorMessage.MALFORMED_URL); } catch (URISyntaxException e) { throw new InvalidURLException(ErrorMessage.INVALID_URI); } }
UrlValidator { public static boolean isUrlValid(String url) { try { new URL(url).toURI(); return true; } catch (MalformedURLException e) { throw new InvalidURLException(ErrorMessage.MALFORMED_URL); } catch (URISyntaxException e) { throw new InvalidURLException(ErrorMessage.INVALID_URI); } } }
UrlValidator { public static boolean isUrlValid(String url) { try { new URL(url).toURI(); return true; } catch (MalformedURLException e) { throw new InvalidURLException(ErrorMessage.MALFORMED_URL); } catch (URISyntaxException e) { throw new InvalidURLException(ErrorMessage.INVALID_URI); } }  }
UrlValidator { public static boolean isUrlValid(String url) { try { new URL(url).toURI(); return true; } catch (MalformedURLException e) { throw new InvalidURLException(ErrorMessage.MALFORMED_URL); } catch (URISyntaxException e) { throw new InvalidURLException(ErrorMessage.INVALID_URI); } }  static boolean isUrlValid(String url); }
UrlValidator { public static boolean isUrlValid(String url) { try { new URL(url).toURI(); return true; } catch (MalformedURLException e) { throw new InvalidURLException(ErrorMessage.MALFORMED_URL); } catch (URISyntaxException e) { throw new InvalidURLException(ErrorMessage.INVALID_URI); } }  static boolean isUrlValid(String url);  }