MailjetSender { public MailjetResponse sendMailjet(String recipient, String sender, MailjetClient client) throws MailjetException, MailjetSocketTimeoutException { MailjetRequest email = new MailjetRequest(Emailv31.resource) .property(Emailv31.MESSAGES, new JSONArray() .put(new JSONObject() .put(Emailv31.Message.FROM, new JSONObject() .put("Email", sender) .put("Name", "pandora")) .put(Emailv31.Message.TO, new JSONArray() .put(new JSONObject() .put("Email", recipient))) .put(Emailv31.Message.SUBJECT, "Your email flight plan!") .put(Emailv31.Message.TEXTPART, "Dear passenger, welcome to Mailjet! May the delivery force be with you!") .put(Emailv31.Message.HTMLPART, "<h3>Dear passenger, welcome to Mailjet!</h3>" + "<br />May the delivery force be with you!"))); try { MailjetResponse response = client.post(email); System.out.println(response.getStatus()); System.out.println(response.getData()); return response; } catch (MailjetException e) { System.out.println("Mailjet Exception: " + e); return null; } }  static void main(String[] args); MailjetResponse sendMailjet(String recipient, String sender, MailjetClient client);  }
@Test public void doGet_defaultEnvironment_writesResponse() throws Exception { sender.sendMailjet("fake recipient", "fake sender", mockClient); Mockito.verify(mockClient).post(Matchers.anyObject()); }