@Test
public void testValidateDomainTemplate() {

    DomainTemplate domainTemplate = new DomainTemplate();
    List<String> names = new ArrayList<>();
    names.add("vipng");
    domainTemplate.setTemplateNames(names);
    
    List<TemplateParam> params = new ArrayList<>();
    params.add(new TemplateParam().setName("param_name_valid").setValue("param_value_valid"));
    domainTemplate.setParams(params);
    
    // our validation should be successful
    
    zms.validate(domainTemplate, "DomainTemplate", "testValidateDomainTemplate");
    
    // now let's add an invalid entry
    
    params.add(new TemplateParam().setName("param_name_invalid.test").setValue("param_value_valid"));
    try {
        zms.validate(domainTemplate, "DomainTemplate", "testValidateDomainTemplate");
        fail();
    } catch (ResourceException ignored) {
    }
    // remove the second element and add another with invalid value
    
    params.remove(1);
    params.add(new TemplateParam().setName("param_name_valid").setValue("param_value_invalid(again)"));
    try {
        zms.validate(domainTemplate, "DomainTemplate", "testValidateDomainTemplate");
        fail();
    } catch (ResourceException ignored) {
    }
}