Example #1
0
  @Test
  public void shouldSendPasswordResetReminder() throws Exception {
    when(templateParser.mergeTemplateIntoString(
            matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params)))
        .thenReturn(EMAIL_MESSAGE);

    emailSender.sendPasswordResetReminder(params);

    verify(templateParser)
        .mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params));
    verify(eventRelay).sendEventMessage(eq(event));
  }
Example #2
0
  @Test
  public void shouldNotSendPasswordResetReminderIfParsingThrowsException() throws Exception {
    when(templateParser.mergeTemplateIntoString(
            matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params)))
        .thenThrow(
            new VelocityTemplateParsingException("Couldn't send password reminder email", null));

    emailSender.sendPasswordResetReminder(params);

    verify(templateParser)
        .mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params));
    verify(eventRelay, never()).sendEventMessage(any(MotechEvent.class));
  }