LayerValidator { public static String sanitizeUrl(final String url) throws IllegalArgumentException { return sanitizeUrl(url, RESERVED_PARAMS); }  static Map<String, Map<String, String>> validateLocale(Map<String, Map<String, String>> locale); static String sanitizeUrl(final String url); static String sanitizeUrl(final String url, Set<String> paramsToRemove); static String sanitizeGFIContent(String gfiContent); static Set<String> getMandatoryFields(String type); static Set<String> getRecognizedLayerTypes(); static void validateAndSanitizeLayerInput(MapLayer input);  }
@Test public void validateUrl() { String url = "https: String validated = LayerValidator.sanitizeUrl(url); assertEquals("URL should be unchanged", url, validated); }
@Test public void validateUrlNull() { String url = null; String validated = LayerValidator.sanitizeUrl(url); assertNull("URL should be unchanged", validated); }
@Test(expected = IllegalArgumentException.class) public void validateUrlNonvalid() { String url = "sgashahah"; String validated = LayerValidator.sanitizeUrl(url); fail("Should have thrown exception"); }