Search in sources :

Example 6 with SendCodeModification

use of alfio.model.modification.SendCodeModification 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)

Example 7 with SendCodeModification

use of alfio.model.modification.SendCodeModification in project alf.io by alfio-event.

the class SpecialPriceManagerTest method validationErrorCodeRequestedTwice.

@Test(expected = IllegalArgumentException.class)
public void validationErrorCodeRequestedTwice() throws Exception {
    List<SendCodeModification> duplicatedCodes = asList(new SendCodeModification("123", "A 123", "123@123", "it"), new SendCodeModification("123", "A 456", "456@456", "en"));
    specialPriceManager.linkAssigneeToCode(duplicatedCodes, "test", 0, "username");
}
Also used : SendCodeModification(alfio.model.modification.SendCodeModification) Test(org.junit.Test)

Aggregations

SendCodeModification (alfio.model.modification.SendCodeModification)7 Test (org.junit.Test)5 Event (alfio.model.Event)4 TextTemplateGenerator (alfio.manager.support.TextTemplateGenerator)2 ContentLanguage (alfio.model.ContentLanguage)1 Organization (alfio.model.user.Organization)1