@Test public void activateVacationShouldNotSendNotificationIfAlreadySent() throws Exception { when(vacationRepository.retrieveVacation(AccountId.fromString(USERNAME))) .thenReturn(Mono.just(VACATION)); when(zonedDateTimeProvider.get()).thenReturn(DATE_TIME_2017); when(notificationRegistry.isRegistered(ACCOUNT_ID, recipientId)) .thenReturn(Mono.just(true)); testee.service(mail); verifyNoMoreInteractions(mailetContext); }
@Override public void service(Mail mail) { try { if (!mail.hasSender()) { return; } if (! automaticallySentMailDetector.isAutomaticallySent(mail)) { ZonedDateTime processingDate = zonedDateTimeProvider.get(); mail.getRecipients() .forEach(mailAddress -> manageVacation(mailAddress, mail, processingDate)); } } catch (Throwable e) { LOGGER.warn("Can not process vacation for one or more recipients in {}", mail.getRecipients(), e); } }
VacationMailet extends GenericMailet { @Override public void service(Mail mail) { try { if (!mail.hasSender()) { return; } if (! automaticallySentMailDetector.isAutomaticallySent(mail)) { ZonedDateTime processingDate = zonedDateTimeProvider.get(); mail.getRecipients() .forEach(mailAddress -> manageVacation(mailAddress, mail, processingDate)); } } catch (Throwable e) { LOGGER.warn("Can not process vacation for one or more recipients in {}", mail.getRecipients(), e); } } }
VacationMailet extends GenericMailet { @Override public void service(Mail mail) { try { if (!mail.hasSender()) { return; } if (! automaticallySentMailDetector.isAutomaticallySent(mail)) { ZonedDateTime processingDate = zonedDateTimeProvider.get(); mail.getRecipients() .forEach(mailAddress -> manageVacation(mailAddress, mail, processingDate)); } } catch (Throwable e) { LOGGER.warn("Can not process vacation for one or more recipients in {}", mail.getRecipients(), e); } } @Inject  VacationMailet(VacationRepository vacationRepository, ZonedDateTimeProvider zonedDateTimeProvider,
                          AutomaticallySentMailDetector automaticallySentMailDetector, NotificationRegistry notificationRegistry,
                          MimeMessageBodyGenerator mimeMessageBodyGenerator); }
VacationMailet extends GenericMailet { @Override public void service(Mail mail) { try { if (!mail.hasSender()) { return; } if (! automaticallySentMailDetector.isAutomaticallySent(mail)) { ZonedDateTime processingDate = zonedDateTimeProvider.get(); mail.getRecipients() .forEach(mailAddress -> manageVacation(mailAddress, mail, processingDate)); } } catch (Throwable e) { LOGGER.warn("Can not process vacation for one or more recipients in {}", mail.getRecipients(), e); } } @Inject  VacationMailet(VacationRepository vacationRepository, ZonedDateTimeProvider zonedDateTimeProvider,
                          AutomaticallySentMailDetector automaticallySentMailDetector, NotificationRegistry notificationRegistry,
                          MimeMessageBodyGenerator mimeMessageBodyGenerator); @Override void service(Mail mail); }
VacationMailet extends GenericMailet { @Override public void service(Mail mail) { try { if (!mail.hasSender()) { return; } if (! automaticallySentMailDetector.isAutomaticallySent(mail)) { ZonedDateTime processingDate = zonedDateTimeProvider.get(); mail.getRecipients() .forEach(mailAddress -> manageVacation(mailAddress, mail, processingDate)); } } catch (Throwable e) { LOGGER.warn("Can not process vacation for one or more recipients in {}", mail.getRecipients(), e); } } @Inject  VacationMailet(VacationRepository vacationRepository, ZonedDateTimeProvider zonedDateTimeProvider,
                          AutomaticallySentMailDetector automaticallySentMailDetector, NotificationRegistry notificationRegistry,
                          MimeMessageBodyGenerator mimeMessageBodyGenerator); @Override void service(Mail mail);  }