CommonsmailHelperImpl implements CommonsmailHelper { @Override public MultiPartEmail createMultiPartEmailWithContent(Mail mail) throws EmailException { MultiPartEmail multiPartEmail; if (mail.getBodyHtml() == null || mail.getBodyHtml().equals("")) { multiPartEmail = new MultiPartEmail(); multiPartEmail.setMsg(mail.getBodyText()); } else if (mail.getBodyText() == null || mail.getBodyText().equals("")) { multiPartEmail = new HtmlEmail().setHtmlMsg(mail.getBodyHtml()); } else { multiPartEmail = new HtmlEmail().setHtmlMsg(mail.getBodyHtml()).setTextMsg(mail.getBodyText()); } return multiPartEmail; }  @Override MultiPartEmail createMultiPartEmailWithContent(Mail mail); @Override void doPopulateMultipartMailWithContent(MultiPartEmail multiPartEmail, Mail mail); @Override void doSetServerParameter(MultiPartEmail multiPartEmail, String smtpHost,
            Integer smtpPort, Boolean smtpSsl, Boolean smtpStartTLS, Boolean smtpStartTLSRequired,
            String smtpUser, String smtpPassword,
            Boolean smtpDebug); @Override List<Tuple<String, String>> createListOfAddresses(Collection<String> emails); @Override Tuple<String, String> createValidEmailFromString(String email);  }
@Test public void testCreateMultiPartEmailWithContent() throws Exception { Mail mail = new MailImpl(); mail.setBodyText("simple body text"); MultiPartEmail multiPartEmail = commonsmailHelper.createMultiPartEmailWithContent(mail); assertTrue(multiPartEmail instanceof MultiPartEmail); mail = new MailImpl(); mail.setBodyHtml("<br>simple body text<br>"); multiPartEmail = commonsmailHelper.createMultiPartEmailWithContent(mail); assertTrue(multiPartEmail instanceof HtmlEmail); mail = new MailImpl(); mail.setBodyText("simple body text"); mail.setBodyHtml("<br>simple body text<br>"); multiPartEmail = commonsmailHelper.createMultiPartEmailWithContent(mail); assertTrue(multiPartEmail instanceof HtmlEmail); }