use of teammates.logic.core.MailjetService in project teammates by TEAMMATES.
the class EmailSenderTest method testConvertToMailjet.
@Test
public void testConvertToMailjet() {
EmailWrapper wrapper = getTypicalEmailWrapper();
MailjetRequest request = new MailjetService().parseToEmail(wrapper);
JSONObject email = new JSONObject(request.getBody());
assertEquals(wrapper.getSenderEmail(), email.get(Email.FROMEMAIL));
assertEquals(wrapper.getSenderName(), email.get(Email.FROMNAME));
assertEquals(wrapper.getRecipient(), ((JSONArray) email.get(Email.RECIPIENTS)).getJSONObject(0).get("Email"));
assertEquals(wrapper.getBcc(), ((JSONArray) email.get(Email.RECIPIENTS)).getJSONObject(1).get("Email"));
assertEquals(wrapper.getReplyTo(), ((JSONObject) email.get(Email.HEADERS)).getString("Reply-To"));
assertEquals(wrapper.getSubject(), email.get(Email.SUBJECT));
assertEquals(wrapper.getContent(), email.get(Email.HTMLPART));
}
Aggregations