@Test
public void validateWMSLayer() {

    MapLayer input = new MapLayer();
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        assertEquals("Required field missing 'type'", e.getMessage());
    }
    input.setType(OskariLayer.TYPE_WMS);
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        assertEquals("Required field missing 'name'", e.getMessage());
    }
    input.setName("testing");
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        assertEquals("Required field missing 'url'", e.getMessage());
    }
    input.setUrl("http://oskari.org/testing");
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        assertEquals("Required field missing 'version'", e.getMessage());
    }
    input.setVersion("1.1.0");
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        //
        assertEquals("Localization for layer names missing", e.getMessage());
    }
    input.setLocale(new HashMap<>());
    try {
        LayerValidator.validateAndSanitizeLayerInput(input);
    } catch (IllegalArgumentException e) {
        // Localization for layer names missing
        assertEquals("Name missing for default language: en", e.getMessage());
    }
    input.setLocale(createValidLocaleForLayer());
    LayerValidator.validateAndSanitizeLayerInput(input);
}