use of org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd in project cloudstack by apache.
the class QuotaResponseBuilderImplTest method testUpdateQuotaEmailTemplate.
@Test
public void testUpdateQuotaEmailTemplate() {
QuotaEmailTemplateUpdateCmd cmd = new QuotaEmailTemplateUpdateCmd();
cmd.setTemplateBody("some body");
cmd.setTemplateName("some name");
cmd.setTemplateSubject("some subject");
List<QuotaEmailTemplatesVO> templates = new ArrayList<>();
Mockito.when(quotaEmailTemplateDao.listAllQuotaEmailTemplates(Mockito.anyString())).thenReturn(templates);
Mockito.when(quotaEmailTemplateDao.updateQuotaEmailTemplate(Mockito.any(QuotaEmailTemplatesVO.class))).thenReturn(true);
// invalid template test
assertFalse(quotaResponseBuilder.updateQuotaEmailTemplate(cmd));
// valid template test
QuotaEmailTemplatesVO template = new QuotaEmailTemplatesVO();
template.setTemplateName("template");
templates.add(template);
assertTrue(quotaResponseBuilder.updateQuotaEmailTemplate(cmd));
}
Aggregations