### Question:
SecurityServiceImpl extends RemoteServiceServlet implements SecurityService { @Override public int changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword, boolean notify) { try { UserDAO userDao = (UserDAO) Context.get().getBean(UserDAO.class); User user = userDao.findById(userId); if (user == null) throw new Exception(String.format("User %s not found", userId)); userDao.initialize(user); User currentUser = null; try { currentUser = ServiceUtil.getSessionUser(getThreadLocalRequest()); } catch (Throwable t) { } MenuDAO mDao = (MenuDAO) Context.get().getBean(MenuDAO.class); if (currentUser != null && currentUser.getId() != userId && !mDao.isReadEnable(Menu.SECURITY, currentUser.getId())) throw new Exception(String.format("User %s not allowed to change the password of user %s", currentUser.getUsername(), user.getUsername())); if (oldPassword != null && !CryptUtil.cryptString(oldPassword).equals(user.getPassword())) throw new Exception("Wrong old passord"); UserHistory history = null; user.setDecodedPassword(newPassword); user.setPasswordChanged(new Date()); user.setRepass(""); history = new UserHistory(); history.setUser(user); history.setEvent(UserEvent.PASSWORDCHANGED.toString()); history.setComment(""); user.setPasswordExpired(notify || requestorUserId == null || !requestorUserId.equals(userId) ? 1 : 0); boolean stored = userDao.store(user, history); if (!stored) throw new Exception("User not stored"); if (notify) try { notifyAccount(user, newPassword); } catch (Throwable e) { log.warn(e.getMessage(), e); return 2; } return 0; } catch (Throwable e) { log.error(e.getMessage(), e); return 1; } }  static GUITenant getTenant(long tenantId); static GUITenant fromTenant(Tenant tenant); static GUITenant getTenant(String tenantName); GUISession loadSession(Session sess, String locale); @Override GUISession getSession(String locale); @Override void logout(); @Override int changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword,
			boolean notify); @Override void addUserToGroup(long groupId, long userId); @Override void deleteGroup(long groupId); @Override void deleteUser(long userId); @Override GUIGroup getGroup(long groupId); @Override GUIUser getUser(long userId); @Override void removeFromGroup(long groupId, long[] userIds); @Override GUIGroup saveGroup(GUIGroup group); @Override GUIUser saveUser(GUIUser user, GUIInfo info); @Override GUIUser saveProfile(GUIUser user); @Override GUIUser saveInterfaceSettings(GUIUser user); @Override void kill(String sid); @Override GUISecuritySettings loadSettings(); @Override boolean saveSettings(GUISecuritySettings settings); @Override void applyRights(GUIMenu menu); @Override GUIMenu getMenu(long menuId); @Override GUIUser[] searchUsers(String username, String groupId); @Override GUISequence[] loadBlockedEntities(); @Override void removeBlockedEntities(long[] ids); @Override void replicateUsersSettings(long masterUserId, Long[] userIds, boolean gui, boolean groups);  }### Answer:
@Test public void testChangePassword() { Assert.assertEquals(0, service.changePassword(1L, 1L, "admin", "test", false)); Assert.assertEquals(0, service.changePassword(1L, 1L, "test", "admin", false)); Assert.assertNotSame(0, service.changePassword(1L, 1L, "xxxxx", "test", false)); }