use of edu.stanford.bmir.protege.web.server.templates.TemplateEngine in project webprotege by protegeproject.
the class CommentNotificationEmailGenerator_TestCase method setUp.
@Before
public void setUp() throws Exception {
when(templateFile.getContents()).thenReturn(TEMPLATE_FILE_CONTENTS);
when(templateFile.getFile()).thenReturn(file);
when(file.getName()).thenReturn(THE_FILE_NAME);
when(comment.getCreatedBy()).thenReturn(creator);
when(creator.getUserName()).thenReturn(USER_NAME);
when(applicationNameSupplier.get()).thenReturn("TheAppName");
when(placeUrl.getProjectUrl(any())).thenReturn("TheProjectUrl");
when(placeUrl.getEntityUrl(any(), any())).thenReturn("TheEntityUrl");
when(entityData.getEntity()).thenReturn(entity);
when(entityData.getBrowserText()).thenReturn("TheBrowserText");
templateEngine = new TemplateEngine(DefaultMustacheFactory::new);
generator = new CommentNotificationEmailGenerator(templateFile, templateEngine, applicationNameSupplier, placeUrl);
}
use of edu.stanford.bmir.protege.web.server.templates.TemplateEngine in project webprotege by protegeproject.
the class PasswordResetMailer_IT method setUp.
@Before
public void setUp() throws Exception {
when(placeUrl.getApplicationUrl()).thenReturn(applicationUrl);
when(appNameProvider.get()).thenReturn(theAppName);
OverridableFile overridableFile = new OverridableFile(TEMPLATE_PATH, new File("/tmp/data"));
FileContents templateFile = new FileContents(overridableFile);
TemplateEngine templateEngine = new TemplateEngine(DefaultMustacheFactory::new);
ResetPasswordMailer mailer = new ResetPasswordMailer(sendMailImpl, templateEngine, templateFile, placeUrl, appNameProvider);
mailer.sendEmail(userId, emailAddress, theNewPassword, e -> {
});
verify(sendMailImpl, times(1)).sendMail(eq(singletonList(emailAddress)), eq("Your password has been reset"), bodyCaptor.capture(), any(MessagingExceptionHandler.class));
}
Aggregations