Search in sources :

Example 1 with BaseTag

use of com.cribbstechnologies.clients.mandrill.model.response.tags.BaseTag in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillTagsRequest method getList.

public TagListResponse getList(BaseMandrillRequest tagsRequest) throws RequestFailedException {
    TagListResponse response = new TagListResponse();
    response.setList(((BaseMandrillAnonymousListResponse<BaseTag>) request.postRequest(tagsRequest, ServiceMethods.Tags.LIST, TagListResponse.class, nameTagReference)).getList());
    return response;
}
Also used : TagListResponse(com.cribbstechnologies.clients.mandrill.model.response.tags.TagListResponse) BaseTag(com.cribbstechnologies.clients.mandrill.model.response.tags.BaseTag)

Example 2 with BaseTag

use of com.cribbstechnologies.clients.mandrill.model.response.tags.BaseTag 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());
}
Also used : BaseMandrillAnonymousListResponse(com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse) TagListResponse(com.cribbstechnologies.clients.mandrill.model.response.tags.TagListResponse) StringWriter(java.io.StringWriter) TypeReference(com.fasterxml.jackson.core.type.TypeReference) BaseTag(com.cribbstechnologies.clients.mandrill.model.response.tags.BaseTag) Test(org.junit.Test)

Aggregations

BaseTag (com.cribbstechnologies.clients.mandrill.model.response.tags.BaseTag)2 TagListResponse (com.cribbstechnologies.clients.mandrill.model.response.tags.TagListResponse)2 BaseMandrillAnonymousListResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillAnonymousListResponse)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1