Search in sources :

Example 1 with MandrillRequestWithName

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName in project Java-Mandrill-Wrapper by cribbstechnologies.

the class TemplatesTest method deleteTemplate.

@Test
public void deleteTemplate() {
    MandrillRequestWithName request = new MandrillRequestWithName();
    request.setName("template1");
    try {
        templatesRequest.deleteTemplate(request);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : MandrillRequestWithName(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) Test(org.junit.Test)

Example 2 with MandrillRequestWithName

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName in project Java-Mandrill-Wrapper by cribbstechnologies.

the class TemplatesTest method testGetTemplateInfo.

@Test
public void testGetTemplateInfo() {
    MandrillRequestWithName request = new MandrillRequestWithName();
    request.setName("template1");
    try {
        templatesRequest.getTemplateInfo(request);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : MandrillRequestWithName(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) Test(org.junit.Test)

Example 3 with MandrillRequestWithName

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName in project Java-Mandrill-Wrapper by cribbstechnologies.

the class TemplatesTest method testUpdateTemplate.

@Test
public void testUpdateTemplate() {
    MandrillRequestWithCode request = new MandrillRequestWithCode();
    request.setName("template1");
    String newVal = "<html><body>Not template</body></html>";
    request.setCode(newVal);
    MandrillRequestWithName retrieve = new MandrillRequestWithName();
    retrieve.setName("template1");
    try {
        TemplateResponse response = templatesRequest.getTemplateInfo(retrieve);
        String oldVal = response.getCode();
        templatesRequest.updateTemplate(request);
        response = templatesRequest.getTemplateInfo(retrieve);
        assertFalse(oldVal.equals(newVal));
        assertEquals(newVal, response.getCode());
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : MandrillRequestWithName(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) TemplateResponse(com.cribbstechnologies.clients.mandrill.model.response.templates.TemplateResponse) MandrillRequestWithCode(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithCode) Test(org.junit.Test)

Aggregations

RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)3 MandrillRequestWithName (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithName)3 Test (org.junit.Test)3 MandrillRequestWithCode (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithCode)1 TemplateResponse (com.cribbstechnologies.clients.mandrill.model.response.templates.TemplateResponse)1