CommonsmailHelperImpl implements CommonsmailHelper { @Override public void doSetServerParameter(MultiPartEmail multiPartEmail, String smtpHost, Integer smtpPort, Boolean smtpSsl, Boolean smtpStartTLS, Boolean smtpStartTLSRequired, String smtpUser, String smtpPassword, Boolean smtpDebug) { multiPartEmail.setHostName(smtpHost); multiPartEmail.setSmtpPort(smtpPort); multiPartEmail.setSSLOnConnect(smtpSsl); multiPartEmail.setStartTLSEnabled(smtpStartTLS); multiPartEmail.setStartTLSRequired(smtpStartTLSRequired); if (smtpUser != null) { multiPartEmail.setAuthentication(smtpUser, smtpPassword); } multiPartEmail.setDebug(smtpDebug); }  @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 testDoSetServerParameter() throws Exception { Mail mail = MailImplTestHelper.getMailImplWithDemoContent(); MultiPartEmail multiPartEmail = commonsmailHelper.createMultiPartEmailWithContent(mail); commonsmailHelper.doSetServerParameter( multiPartEmail, "mail.superserver.com", 33, true, false, false, "username", "password", true); assertEquals("33", multiPartEmail.getSmtpPort()); assertEquals("mail.superserver.com", multiPartEmail.getHostName()); assertEquals(true, multiPartEmail.getMailSession().getDebug()); }