MailSender { public void sendMail() { try { Transport.send(message); } catch (MessagingException e) { logger.warn("send message failed", e); } }  static MailSender create(); MailSender createSession(Authenticator authenticator); MailSender buildMsg(Email email); void sendMail();  }
@Test public void testSendMail() throws Exception{ MailSender mailSender = new MailSender(); Email email = new Email(); email.setContent("test"); mailSender.createSession(new HiAlanMailAuthenticator("", "")).buildMsg(email).sendMail(); }