@Test public void shouldThrowErrorIfPasswordResetTokenIsInValidWhileGettingUserId() throws Exception { String invalidToken = "invalidToken"; when(userRepository.getUserIdForPasswordResetToken(invalidToken)).thenReturn(null); expectedException.expect(DataException.class); expectedException.expectMessage(PASSWORD_RESET_TOKEN_INVALID); userService.getUserIdByPasswordResetToken(invalidToken); }
public Long getUserIdByPasswordResetToken(String token) { Long userId = userRepository.getUserIdForPasswordResetToken(token); if (userId == null) { throw new DataException(PASSWORD_RESET_TOKEN_INVALID); } return userId; }
UserService { public Long getUserIdByPasswordResetToken(String token) { Long userId = userRepository.getUserIdForPasswordResetToken(token); if (userId == null) { throw new DataException(PASSWORD_RESET_TOKEN_INVALID); } return userId; } }
UserService { public Long getUserIdByPasswordResetToken(String token) { Long userId = userRepository.getUserIdForPasswordResetToken(token); if (userId == null) { throw new DataException(PASSWORD_RESET_TOKEN_INVALID); } return userId; }  }
UserService { public Long getUserIdByPasswordResetToken(String token) { Long userId = userRepository.getUserIdForPasswordResetToken(token); if (userId == null) { throw new DataException(PASSWORD_RESET_TOKEN_INVALID); } return userId; }  static String getCommaSeparatedIds(List<Long> idList); @Transactional void create(User user, String resetPasswordLink); void createUser(User user, String passwordResetLink); @Transactional void update(User user); LinkedHashMap getPreferences(Long userId); void sendForgotPasswordEmail(User user, String resetPasswordLink); List<User> searchUser(String searchParam, Pagination pagination); User getUserWithRolesById(Long id); User getById(Long id); Long getUserIdByPasswordResetToken(String token); @Transactional void updateUserPassword(String token, String password); User getByUserName(String userName); User selectUserByUserNameAndPassword(String userName, String password); void updateUserPassword(Long userId, String password); @Transactional void disable(Long userId, Long modifiedBy); List<User> getUsersWithRightInNodeForProgram(Program program, SupervisoryNode node, String rightName); List<User> getUsersWithRightInHierarchyUsingBaseNode(Long nodeId, Program program, String rightName); List<User> getUsersWithRightOnWarehouse(Long id, String rightName); ArrayList<User> filterForActiveUsers(List<User> userList); Integer getTotalSearchResultCount(String searchParam); @Transactional String updateUserPreferences(Long userId, User user, Long programId, Long facilityId, List<Long> products); List<String> getSupervisoryRights(Long userId); }
UserService { public Long getUserIdByPasswordResetToken(String token) { Long userId = userRepository.getUserIdForPasswordResetToken(token); if (userId == null) { throw new DataException(PASSWORD_RESET_TOKEN_INVALID); } return userId; }  static String getCommaSeparatedIds(List<Long> idList); @Transactional void create(User user, String resetPasswordLink); void createUser(User user, String passwordResetLink); @Transactional void update(User user); LinkedHashMap getPreferences(Long userId); void sendForgotPasswordEmail(User user, String resetPasswordLink); List<User> searchUser(String searchParam, Pagination pagination); User getUserWithRolesById(Long id); User getById(Long id); Long getUserIdByPasswordResetToken(String token); @Transactional void updateUserPassword(String token, String password); User getByUserName(String userName); User selectUserByUserNameAndPassword(String userName, String password); void updateUserPassword(Long userId, String password); @Transactional void disable(Long userId, Long modifiedBy); List<User> getUsersWithRightInNodeForProgram(Program program, SupervisoryNode node, String rightName); List<User> getUsersWithRightInHierarchyUsingBaseNode(Long nodeId, Program program, String rightName); List<User> getUsersWithRightOnWarehouse(Long id, String rightName); ArrayList<User> filterForActiveUsers(List<User> userList); Integer getTotalSearchResultCount(String searchParam); @Transactional String updateUserPreferences(Long userId, User user, Long programId, Long facilityId, List<Long> products); List<String> getSupervisoryRights(Long userId);  }