use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testTemplateListResponseConversion.
@Test
public void testTemplateListResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("templates/templatesListResponse.txt"), sw);
TypeReference templatesListReference = new TypeReference<List<TemplateResponse>>() {
};
BaseMandrillAnonymousListResponse<TemplateResponse> response = (BaseMandrillAnonymousListResponse<TemplateResponse>) this.request.convertAnonymousListResponseData(sw.toString(), TemplateResponse.class, templatesListReference);
assertEquals(2, response.getList().size());
TemplateResponse tr = response.getList().get(0);
assertEquals("example name1", tr.getName());
assertEquals("example code1", tr.getCode());
assertEquals("example created_at1", tr.getCreated_at());
assertEquals("example updated_at1", tr.getUpdated_at());
tr = response.getList().get(1);
assertEquals("example name11", tr.getName());
assertEquals("example code11", tr.getCode());
assertEquals("example created_at11", tr.getCreated_at());
assertEquals("example updated_at11", tr.getUpdated_at());
}
use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testListTagsResponseConversion.
@Test
public void testListTagsResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("tags/listResponse.txt"), sw);
TypeReference tagListReference = new TypeReference<List<BaseTag>>() {
};
BaseMandrillAnonymousListResponse<BaseTag> response = (BaseMandrillAnonymousListResponse<BaseTag>) this.request.convertAnonymousListResponseData(sw.toString(), TagListResponse.class, tagListReference);
assertEquals(2, response.getList().size());
BaseTag tag = response.getList().get(0);
assertEquals("example tag1", tag.getTag());
assertEquals(1, tag.getSent());
assertEquals(2, tag.getHard_bounces());
assertEquals(3, tag.getSoft_bounces());
assertEquals(4, tag.getRejects());
assertEquals(5, tag.getComplaints());
assertEquals(6, tag.getUnsubs());
assertEquals(7, tag.getOpens());
assertEquals(8, tag.getClicks());
tag = response.getList().get(1);
assertEquals("example tag11", tag.getTag());
assertEquals(11, tag.getSent());
assertEquals(12, tag.getHard_bounces());
assertEquals(13, tag.getSoft_bounces());
assertEquals(14, tag.getRejects());
assertEquals(15, tag.getComplaints());
assertEquals(16, tag.getUnsubs());
assertEquals(17, tag.getOpens());
assertEquals(18, tag.getClicks());
}
Aggregations