MailEngine { public void send(SimpleMailMessage msg) throws MailException { try { mailSender.send(msg); } catch (MailException ex) { log.error(ex.getMessage()); throw ex; } }  void setMailSender(MailSender mailSender); MailSender getMailSender(); void setVelocityEngine(VelocityEngine velocityEngine); void setFrom(String from); void sendMessage(SimpleMailMessage msg, String templateName, Map model); void send(SimpleMailMessage msg); void sendMessage(String[] recipients, String sender, 
                            ClassPathResource resource, String bodyText,
                            String subject, String attachmentName);  }
@Test public void testSend() throws Exception { Wiser wiser = new Wiser(); int port = 2525 + (int)(Math.random() * 100); mailSender.setPort(port); wiser.setPort(port); wiser.start(); Date dte = new Date(); this.mailMessage.setTo("foo@bar.com"); String emailSubject = "grepster testSend: " + dte; String emailBody = "Body of the grepster testSend message sent at: " + dte; this.mailMessage.setSubject(emailSubject); this.mailMessage.setText(emailBody); this.mailEngine.send(this.mailMessage); wiser.stop(); assertTrue(wiser.getMessages().size() == 1); WiserMessage wm = wiser.getMessages().get(0); assertEquals(emailSubject, wm.getMimeMessage().getSubject()); assertEquals(emailBody, wm.getMimeMessage().getContent()); }