### Question:
URLUtil { public static void validateUrlParameter(String name, String url) { try { new URL(url).toURI(); } catch (Exception e) { throw new IllegalArgumentException(name + " " + url + " is not valid URI: "+e.getMessage(), e); } url = url.trim().toLowerCase(); if (!url.startsWith("http: throw new IllegalArgumentException("Only http or https URL is allowed"); }  static void validateUrlParameter(String name, String url);  }### Answer:
@Test public void testValid() { URLUtil.validateUrlParameter("Name", "http: URLUtil.validateUrlParameter("Name", "https: URLUtil.validateUrlParameter("Name", "http: URLUtil.validateUrlParameter("Name", "https: URLUtil.validateUrlParameter("Name", "http: URLUtil.validateUrlParameter("Name", "HTTP: URLUtil.validateUrlParameter("Name", "HTTPS: }
@Test public void testNotValidFtp() { thrown.expect(IllegalArgumentException.class); URLUtil.validateUrlParameter("Name", "ftp: }
@Test public void testNotValidtext() { thrown.expect(IllegalArgumentException.class); URLUtil.validateUrlParameter("Name", "something here"); }