### Question:
AcmLoginSuccessOperations { protected void setPasswordExpirationSessionAttribute(HttpServletRequest request) { HttpSession session = request.getSession(false); AcmUser acmUser = (AcmUser) session.getAttribute("acm_user"); LocalDate passwordExpirationDate = acmUser.getPasswordExpirationDate(); LocalDate today = LocalDate.now(); if (passwordExpirationDate != null) { long daysBetween = DAYS.between(today, passwordExpirationDate); if (daysBetween <= DAYS_TO_PASSWORD_EXPIRATION) { String daysToExpiration = daysBetween == 0 ? "today" : String.format("in %d day(s)", daysBetween); session.setAttribute("acm_user_message", "Your password expires " + daysToExpiration + ", please change it before expiration date."); } } }  void onSuccessfulAuthentication(HttpServletRequest request, Authentication authentication); AcmPluginManager getAcmPluginManager(); void setAcmPluginManager(AcmPluginManager acmPluginManager); AcmApplication getAcmApplication(); void setAcmApplication(AcmApplication acmApplication); UserDao getUserDao(); void setUserDao(UserDao userDao); AuditPropertyEntityAdapter getAuditPropertyEntityAdapter(); void setAuditPropertyEntityAdapter(AuditPropertyEntityAdapter auditPropertyEntityAdapter); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }### Answer:
@Test public void addUserLoginMessageToSessionTest() { AcmUser mockUser = new AcmUser(); mockUser.setPasswordExpirationDate(LocalDate.now().plusDays(3)); expect(mockRequest.getSession(false)).andReturn(mockSession); expect(mockSession.getAttribute("acm_user")).andReturn(mockUser); mockSession.setAttribute("acm_user_message", "Your password expires in 3 day(s), please change it before expiration date."); replayAll(); unit.setPasswordExpirationSessionAttribute(mockRequest); verifyAll(); }
@Test public void noUserLoginMessageToSessionTest() throws Exception { AcmUser mockUser = new AcmUser(); mockUser.setPasswordExpirationDate(LocalDate.now().plusDays(11)); expect(mockRequest.getSession(false)).andReturn(mockSession); expect(mockSession.getAttribute("acm_user")).andReturn(mockUser); replayAll(); unit.setPasswordExpirationSessionAttribute(mockRequest); verifyAll(); }