use of com.cribbstechnologies.clients.mandrill.model.response.urls.TimeUrlResponse 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());
}
Aggregations