@Test public void getContextMap() { var newDateTime = LocalDateTime.now(); var formattedNewEndDateTime = newDateTime.format(MailUserAccessEventHandler.DATE_TIME_FORMATTER); var expectedContextMap = Map.of( "userData", userDataMock, "newDate", formattedNewEndDateTime, "projectBoardUrl", PROJECT_BOARD_URL ); given(userServiceMock.getUserData(userMock)).willReturn(userDataMock); var actualContextMap = mailUserAccessEventHandler.getContextMap(userMock, newDateTime); assertThat(actualContextMap).isEqualTo(expectedContextMap); }
Map<String, Object> getContextMap(User user, LocalDateTime newEndTime) { var newDateAndTime = newEndTime.format(DATE_TIME_FORMATTER); var userData = userService.getUserData(user); return Map.of( "userData", userData, "newDate", newDateAndTime, "projectBoardUrl", projectBoardUrl ); }
MailUserAccessEventHandler implements UserAccessEventHandler { Map<String, Object> getContextMap(User user, LocalDateTime newEndTime) { var newDateAndTime = newEndTime.format(DATE_TIME_FORMATTER); var userData = userService.getUserData(user); return Map.of( "userData", userData, "newDate", newDateAndTime, "projectBoardUrl", projectBoardUrl ); } }
MailUserAccessEventHandler implements UserAccessEventHandler { Map<String, Object> getContextMap(User user, LocalDateTime newEndTime) { var newDateAndTime = newEndTime.format(DATE_TIME_FORMATTER); var userData = userService.getUserData(user); return Map.of( "userData", userData, "newDate", newDateAndTime, "projectBoardUrl", projectBoardUrl ); } MailUserAccessEventHandler(MailSenderAdapter mailSenderAdapter,
                                      UserService userService,
                                      VelocityMailTemplateService velocityMailTemplateService,
                                      ProjectBoardConfigurationProperties configurationProperties); }
MailUserAccessEventHandler implements UserAccessEventHandler { Map<String, Object> getContextMap(User user, LocalDateTime newEndTime) { var newDateAndTime = newEndTime.format(DATE_TIME_FORMATTER); var userData = userService.getUserData(user); return Map.of( "userData", userData, "newDate", newDateAndTime, "projectBoardUrl", projectBoardUrl ); } 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 { Map<String, Object> getContextMap(User user, LocalDateTime newEndTime) { var newDateAndTime = newEndTime.format(DATE_TIME_FORMATTER); var userData = userService.getUserData(user); return Map.of( "userData", userData, "newDate", newDateAndTime, "projectBoardUrl", projectBoardUrl ); } 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);  }