use of alfio.manager.support.TemplateGenerator in project alf.io by alfio-event.
the class SpecialPriceManagerTest method trimLanguageTag.
@Test
public void trimLanguageTag() {
when(configurationManager.getFor(eq(USE_PARTNER_CODE_INSTEAD_OF_PROMOTIONAL), any())).thenReturn(new ConfigurationManager.MaybeConfiguration(USE_PARTNER_CODE_INSTEAD_OF_PROMOTIONAL));
when(specialPriceRepository.findActiveByCategoryIdForUpdate(eq(0), eq(1))).thenReturn(List.of(specialPrice1));
Assertions.assertTrue(specialPriceManager.sendCodeToAssignee(singletonList(new SendCodeModification("123", "me", "me@domain.com", " it")), "", 0, ""));
ArgumentCaptor<TemplateGenerator> templateCaptor = ArgumentCaptor.forClass(TemplateGenerator.class);
verify(notificationManager).sendSimpleEmail(eq(event), isNull(), eq("me@domain.com"), anyString(), templateCaptor.capture());
templateCaptor.getValue().generate();
@SuppressWarnings("rawtypes") 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();
Assertions.assertEquals("123", model.get("code"));
Assertions.assertEquals(event, model.get("event"));
Assertions.assertEquals(organization, model.get("organization"));
Assertions.assertEquals("http://my-event", model.get("eventPage"));
Assertions.assertEquals("me", model.get("assignee"));
verify(messageSource).getMessage(eq("email-code.subject"), eq(new Object[] { "Event Name", null }), eq(Locale.ITALIAN));
}
use of alfio.manager.support.TemplateGenerator in project alf.io by alfio-event.
the class SpecialPriceManagerTest method sendMessage.
private void sendMessage(String promoCodeDescription) {
Assertions.assertTrue(specialPriceManager.sendCodeToAssignee(singletonList(new SendCodeModification("123", "me", "me@domain.com", "it")), "", 0, ""));
ArgumentCaptor<TemplateGenerator> templateCaptor = ArgumentCaptor.forClass(TemplateGenerator.class);
verify(notificationManager).sendSimpleEmail(eq(event), isNull(), eq("me@domain.com"), anyString(), templateCaptor.capture());
templateCaptor.getValue().generate();
@SuppressWarnings("rawtypes") 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();
Assertions.assertEquals("123", model.get("code"));
Assertions.assertEquals(event, model.get("event"));
Assertions.assertEquals(organization, model.get("organization"));
Assertions.assertEquals("http://my-event", model.get("eventPage"));
Assertions.assertEquals("me", model.get("assignee"));
verify(messageSource).getMessage(eq("email-code.subject"), eq(new Object[] { "Event Name", promoCodeDescription }), eq(Locale.ITALIAN));
}
Aggregations