@Test public void getTemplatePathAccessChangedReturnsPathForExtendedWhenNewAfterOld() { var expectedTemplatePath = "/templates/mail/UserAccessExtended.vm"; var oldEndTime = LocalDateTime.of(2019, 2, 3, 10, 0); var newEndTime = oldEndTime.plus(1L, ChronoUnit.HOURS); var actualTemplatePath = mailUserAccessEventHandler.getTemplatePathAccessChanged(newEndTime, oldEndTime); assertThat(actualTemplatePath).isEqualTo(expectedTemplatePath); }
String getTemplatePathAccessChanged(LocalDateTime newEndTime, LocalDateTime previousEndTime) { if(previousEndTime.isAfter(newEndTime)) { return "/templates/mail/UserAccessShortened.vm"; } else { return "/templates/mail/UserAccessExtended.vm"; } }
MailUserAccessEventHandler implements UserAccessEventHandler { String getTemplatePathAccessChanged(LocalDateTime newEndTime, LocalDateTime previousEndTime) { if(previousEndTime.isAfter(newEndTime)) { return "/templates/mail/UserAccessShortened.vm"; } else { return "/templates/mail/UserAccessExtended.vm"; } } }
MailUserAccessEventHandler implements UserAccessEventHandler { String getTemplatePathAccessChanged(LocalDateTime newEndTime, LocalDateTime previousEndTime) { if(previousEndTime.isAfter(newEndTime)) { return "/templates/mail/UserAccessShortened.vm"; } else { return "/templates/mail/UserAccessExtended.vm"; } } MailUserAccessEventHandler(MailSenderAdapter mailSenderAdapter,
                                      UserService userService,
                                      VelocityMailTemplateService velocityMailTemplateService,
                                      ProjectBoardConfigurationProperties configurationProperties); }
MailUserAccessEventHandler implements UserAccessEventHandler { String getTemplatePathAccessChanged(LocalDateTime newEndTime, LocalDateTime previousEndTime) { if(previousEndTime.isAfter(newEndTime)) { return "/templates/mail/UserAccessShortened.vm"; } else { return "/templates/mail/UserAccessExtended.vm"; } } MailUserAccessEventHandler(MailSenderAdapter mailSenderAdapter,
                                      UserService userService,
                                      VelocityMailTemplateService velocityMailTemplateService,
                                      ProjectBoardConfigurationProperties configurationProperties); @Override void onAccessCreated(User user, AccessInterval accessInterval); @Override void onAccessChanged(User user, AccessInterval accessInterval, LocalDateTime previousEndTime); @Override void onAccessRevoked(User user, LocalDateTime previousEndTime); }
MailUserAccessEventHandler implements UserAccessEventHandler { String getTemplatePathAccessChanged(LocalDateTime newEndTime, LocalDateTime previousEndTime) { if(previousEndTime.isAfter(newEndTime)) { return "/templates/mail/UserAccessShortened.vm"; } else { return "/templates/mail/UserAccessExtended.vm"; } } MailUserAccessEventHandler(MailSenderAdapter mailSenderAdapter,
                                      UserService userService,
                                      VelocityMailTemplateService velocityMailTemplateService,
                                      ProjectBoardConfigurationProperties configurationProperties); @Override void onAccessCreated(User user, AccessInterval accessInterval); @Override void onAccessChanged(User user, AccessInterval accessInterval, LocalDateTime previousEndTime); @Override void onAccessRevoked(User user, LocalDateTime previousEndTime);  }