use of com.cribbstechnologies.clients.mandrill.model.response.message.MessageResponse 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.message.MessageResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillMessagesRequest method sendMessage.
/**
* Send a new transactional message through Mandrill
*
* @param messageRequest
* a populated @see com.cribstechnologies.clients.mandrill.model.MandrillMessageRequest
* @throws RequestFailedException
*/
public SendMessageResponse sendMessage(MandrillMessageRequest messageRequest) throws RequestFailedException {
SendMessageResponse response = new SendMessageResponse();
response.setList(((BaseMandrillAnonymousListResponse<MessageResponse>) request.postRequest(messageRequest, ServiceMethods.Messages.SEND, SendMessageResponse.class, messageResponseListReference)).getList());
return response;
}
use of com.cribbstechnologies.clients.mandrill.model.response.message.MessageResponse in project Java-Mandrill-Wrapper by cribbstechnologies.
the class MandrillMessagesRequest method sendTemplatedMessage.
public SendMessageResponse sendTemplatedMessage(MandrillTemplatedMessageRequest templateMessage) throws RequestFailedException {
SendMessageResponse response = new SendMessageResponse();
response.setList(((BaseMandrillAnonymousListResponse<MessageResponse>) request.postRequest(templateMessage, ServiceMethods.Messages.SEND_TEMPLATE, SendMessageResponse.class, messageResponseListReference)).getList());
return response;
}
Aggregations