use of alfio.manager.support.TextTemplateGenerator in project alf.io by alfio-event.
the class SpecialPriceManagerTest method trimLanguageTag.
@Test
public void trimLanguageTag() throws Exception {
assertTrue(specialPriceManager.sendCodeToAssignee(singletonList(new SendCodeModification("123", "me", "me@domain.com", " it")), "", 0, ""));
ArgumentCaptor<TextTemplateGenerator> templateCaptor = ArgumentCaptor.forClass(TextTemplateGenerator.class);
verify(notificationManager).sendSimpleEmail(eq(event), eq("me@domain.com"), anyString(), templateCaptor.capture());
templateCaptor.getValue().generate();
ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
verify(templateManager).renderTemplate(any(Event.class), eq(TemplateResource.SEND_RESERVED_CODE), captor.capture(), eq(Locale.ITALIAN));
Map<String, Object> model = captor.getValue();
assertEquals("123", model.get("code"));
assertEquals(event, model.get("event"));
assertEquals(organization, model.get("organization"));
assertEquals("http://my-event", model.get("eventPage"));
assertEquals("me", model.get("assignee"));
verify(messageSource).getMessage(eq("email-code.subject"), eq(new Object[] { "Event Name" }), eq(Locale.ITALIAN));
}
use of alfio.manager.support.TextTemplateGenerator in project alf.io by alfio-event.
the class SpecialPriceManagerTest method sendSuccessfulComplete.
@Test
public void sendSuccessfulComplete() throws Exception {
assertTrue(specialPriceManager.sendCodeToAssignee(singletonList(new SendCodeModification("123", "me", "me@domain.com", "it")), "", 0, ""));
ArgumentCaptor<TextTemplateGenerator> templateCaptor = ArgumentCaptor.forClass(TextTemplateGenerator.class);
verify(notificationManager).sendSimpleEmail(eq(event), eq("me@domain.com"), anyString(), templateCaptor.capture());
templateCaptor.getValue().generate();
ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
verify(templateManager).renderTemplate(any(Event.class), eq(TemplateResource.SEND_RESERVED_CODE), captor.capture(), eq(Locale.ITALIAN));
Map<String, Object> model = captor.getValue();
assertEquals("123", model.get("code"));
assertEquals(event, model.get("event"));
assertEquals(organization, model.get("organization"));
assertEquals("http://my-event", model.get("eventPage"));
assertEquals("me", model.get("assignee"));
verify(messageSource).getMessage(eq("email-code.subject"), eq(new Object[] { "Event Name" }), eq(Locale.ITALIAN));
}
Aggregations