MailerWithTemplate { public MailerResult sendMailUsingTemplateContext(OLATPrincipal recipientTO, List<? extends OLATPrincipal> recipientsCC, List<? extends OLATPrincipal> recipientsBCC, MailTemplate template, OLATPrincipal sender) { MailerResult result = new MailerResult(); sendWithContext(template.getContext(), recipientTO, recipientsCC, recipientsBCC, template, sender, result); return result; } private  MailerWithTemplate(); private  MailerWithTemplate(MailPackageStaticDependenciesWrapper webappAndMailHelper); static MailerWithTemplate getInstance(); MailerResult sendMailUsingTemplateContext(OLATPrincipal recipientTO, List<? extends OLATPrincipal> recipientsCC, List<? extends OLATPrincipal> recipientsBCC,
            MailTemplate template, OLATPrincipal sender); String[] previewSubjectAndBody(OLATPrincipal recipientTO, List<? extends OLATPrincipal> recipientsCC, List<? extends OLATPrincipal> recipientsBCC,
            MailTemplate template, OLATPrincipal sender); MailerResult sendMail(OLATPrincipal recipientTO, List<? extends OLATPrincipal> recipientsCC, List<? extends OLATPrincipal> recipientsBCC,
            MailTemplate template, OLATPrincipal sender); MailerResult sendMailAsSeparateMails(List<? extends OLATPrincipal> recipientsTO, List<? extends OLATPrincipal> recipientsCC,
            List<? extends OLATPrincipal> recipientsBCC, MailTemplate template, OLATPrincipal sender);  }
@Test public void testSendMailFromRuediToPeterUsingTemplateContextWithoutOtherRecipients() { MailerResult result = mailerWithTemplate.sendMailUsingTemplateContext(peter, null, null, template, ruedi); assertEquals(MailerResult.OK, result.getReturnCode()); List<OLATPrincipal> recipient = new ArrayList<OLATPrincipal>(); recipient.add(peter); verifyTimesCallingCreateAndSendMessageInvocationsFor(1, recipient, null, null); }
@Test public void testSendMailFromSystemToPeterUsingTemplateContextWithoutOtherRecipients() { OLATPrincipal systemAsSender = null; MailerResult result = mailerWithTemplate.sendMailUsingTemplateContext(peter, null, null, template, systemAsSender); assertEquals(MailerResult.OK, result.getReturnCode()); List<OLATPrincipal> recipient = new ArrayList<OLATPrincipal>(); recipient.add(peter); verifyTimesCallingCreateAndSendMessageInvocationsFor(1, recipient, null, null); }