Search in sources :

Example 1 with TextTemplateGenerator

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));
}
Also used : TextTemplateGenerator(alfio.manager.support.TextTemplateGenerator) Event(alfio.model.Event) SendCodeModification(alfio.model.modification.SendCodeModification) Test(org.junit.Test)

Example 2 with TextTemplateGenerator

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));
}
Also used : TextTemplateGenerator(alfio.manager.support.TextTemplateGenerator) Event(alfio.model.Event) SendCodeModification(alfio.model.modification.SendCodeModification) Test(org.junit.Test)

Aggregations

TextTemplateGenerator (alfio.manager.support.TextTemplateGenerator)2 Event (alfio.model.Event)2 SendCodeModification (alfio.model.modification.SendCodeModification)2 Test (org.junit.Test)2