use of com.cribbstechnologies.clients.mandrill.model.response.users.MandrillSender 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());
}
use of com.cribbstechnologies.clients.mandrill.model.response.users.MandrillSender in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillUsersRequest method getSenders.
/**
* Return the senders that have tried to use this account, both verified and unverified
*
* @param sendersRequest
* a populated @see com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest
* @throws RequestFailedException
*/
public UsersSendersResponse getSenders(BaseMandrillRequest sendersRequest) throws RequestFailedException {
UsersSendersResponse response = new UsersSendersResponse();
response.setList(((BaseMandrillAnonymousListResponse<MandrillSender>) request.postRequest(sendersRequest, ServiceMethods.Users.SENDERS, UsersSendersResponse.class, usersListReference)).getList());
return response;
}
Aggregations