Search in sources :

Example 1 with QuotaEmailTemplateUpdateCmd

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));
}
Also used : QuotaEmailTemplatesVO(org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO) ArrayList(java.util.ArrayList) QuotaEmailTemplateUpdateCmd(org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 QuotaEmailTemplateUpdateCmd (org.apache.cloudstack.api.command.QuotaEmailTemplateUpdateCmd)1 QuotaEmailTemplatesVO (org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO)1 Test (org.junit.Test)1