DefaultMailBox implements MailBox, JsonMapper { @Override public void sendConflictsMail(Map<String, List<PdpPolicyDefinition>> conflicts) { try { Map<String, String> variables = new HashMap<>(); variables.put("@@to@@", to); variables.put("@@conflicts@@", objectToTable(conflicts)); variables.put("@@base_url@@", baseUrl); sendMail("mail/conflicts.html", "PDP Conflicts", variables); } catch (MessagingException | IOException e) { throw new RuntimeException(e); } } DefaultMailBox(String baseUrl, String to, String from); @Override void sendConflictsMail(Map<String, List<PdpPolicyDefinition>> conflicts); @Override void sendInvalidPoliciesMail(List<PdpPolicyDefinition> invalids);  }
@Test public void testMailBox() throws Exception { Map<String, List<PdpPolicyDefinition>> conflicts = new HashMap<>(); PdpPolicyDefinition pdpPolicyDefinition = policyDefinition("sp1", asList("idp1", "idp2")); pdpPolicyDefinition.setDescription("$"); conflicts.put("https: mailBox.sendConflictsMail(conflicts); Thread.sleep(1500); MimeMessage mimeMessage = greenMail.getReceivedMessages()[0]; String body = getBody(mimeMessage); assertTrue(body.contains("http: assertEquals("to@test.nl", mimeMessage.getRecipients(Message.RecipientType.TO)[0].toString()); }