use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testSendMessageResponseConversion.
@Test
public void testSendMessageResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("messages/sendMessageResponse.txt"), sw);
TypeReference responseListReference = new TypeReference<List<MessageResponse>>() {
};
BaseMandrillAnonymousListResponse<MessageResponse> response = (BaseMandrillAnonymousListResponse<MessageResponse>) this.request.convertAnonymousListResponseData(sw.toString(), SendMessageResponse.class, responseListReference);
assertEquals(2, response.getList().size());
MessageResponse resp = response.getList().get(0);
assertEquals("example email", resp.getEmail());
assertEquals("example status", resp.getStatus());
resp = response.getList().get(1);
assertEquals("example email2", resp.getEmail());
assertEquals("example status2", resp.getStatus());
}
use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testUrlListResponseConversion.
@Test
public void testUrlListResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("urls/urlList.txt"), sw);
TypeReference urlListReference = new TypeReference<List<UrlResponse>>() {
};
BaseMandrillAnonymousListResponse<UrlResponse> response = (BaseMandrillAnonymousListResponse<UrlResponse>) this.request.convertAnonymousListResponseData(sw.toString(), UrlListResponse.class, urlListReference);
assertEquals(2, response.getList().size());
UrlResponse urlResponse = response.getList().get(0);
assertEquals("example url1", urlResponse.getUrl());
assertEquals(2, urlResponse.getSent());
assertEquals(3, urlResponse.getClicks());
assertEquals(4, urlResponse.getUnique_clicks());
urlResponse = response.getList().get(1);
assertEquals("example url11", urlResponse.getUrl());
assertEquals(12, urlResponse.getSent());
assertEquals(13, urlResponse.getClicks());
assertEquals(14, urlResponse.getUnique_clicks());
}
use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testUrlTimeResponseConversion.
@Test
public void testUrlTimeResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("urls/urlTimeResponse.txt"), sw);
TypeReference urlTimeReference = new TypeReference<List<TimeUrlResponse>>() {
};
BaseMandrillAnonymousListResponse<TimeUrlResponse> response = (BaseMandrillAnonymousListResponse<TimeUrlResponse>) this.request.convertAnonymousListResponseData(sw.toString(), UrlTimeResponse.class, urlTimeReference);
assertEquals(2, response.getList().size());
TimeUrlResponse timeUrlResponse = response.getList().get(0);
assertEquals("example time1", timeUrlResponse.getTime());
assertEquals(2, timeUrlResponse.getSent());
assertEquals(3, timeUrlResponse.getClicks());
assertEquals(4, timeUrlResponse.getUnique_clicks());
timeUrlResponse = response.getList().get(1);
assertEquals("example time11", timeUrlResponse.getTime());
assertEquals(12, timeUrlResponse.getSent());
assertEquals(13, timeUrlResponse.getClicks());
assertEquals(14, timeUrlResponse.getUnique_clicks());
}
use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testTimeTagsResponseConversion.
@Test
public void testTimeTagsResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("tags/timeSeriesResponse.txt"), sw);
TypeReference tagListReference = new TypeReference<List<TagWithTime>>() {
};
BaseMandrillAnonymousListResponse<TagWithTime> response = (BaseMandrillAnonymousListResponse<TagWithTime>) this.request.convertAnonymousListResponseData(sw.toString(), TagSeriesResponse.class, tagListReference);
assertEquals(2, response.getList().size());
TagWithTime tag = response.getList().get(0);
assertEquals("example time1", tag.getTime());
assertEquals(2, tag.getSent());
assertEquals(3, tag.getHard_bounces());
assertEquals(4, tag.getSoft_bounces());
assertEquals(5, tag.getRejects());
assertEquals(6, tag.getComplaints());
assertEquals(7, tag.getOpens());
assertEquals(8, tag.getUnique_opens());
assertEquals(9, tag.getClicks());
assertEquals(10, tag.getUnique_clicks());
tag = response.getList().get(1);
assertEquals("example time11", tag.getTime());
assertEquals(12, tag.getSent());
assertEquals(13, tag.getHard_bounces());
assertEquals(14, tag.getSoft_bounces());
assertEquals(15, tag.getRejects());
assertEquals(16, tag.getComplaints());
assertEquals(17, tag.getOpens());
assertEquals(18, tag.getUnique_opens());
assertEquals(19, tag.getClicks());
assertEquals(110, tag.getUnique_clicks());
}
use of com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillRESTRequestTest method testSendersResponseConversion.
@Test
public void testSendersResponseConversion() throws IOException {
this.initRequestWithActualMapper();
StringWriter sw = new StringWriter();
IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("users/sendersResponse.txt"), sw);
TypeReference usersListReference = new TypeReference<List<MandrillSender>>() {
};
BaseMandrillAnonymousListResponse<MandrillSender> response = (BaseMandrillAnonymousListResponse<MandrillSender>) this.request.convertAnonymousListResponseData(sw.toString(), UsersSendersResponse.class, usersListReference);
assertEquals(2, response.getList().size());
MandrillSender sender = response.getList().get(0);
assertEquals("example address", sender.getAddress());
assertEquals("example created_at", sender.getCreated_at());
assertTrue(sender.getIs_enabled());
sender = response.getList().get(1);
assertEquals("example address2", sender.getAddress());
assertEquals("example created_at2", sender.getCreated_at());
assertFalse(sender.getIs_enabled());
}
Aggregations