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));
}
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");
}
Aggregations