### Question:
UserDao extends BaseDao<User> implements UserStore { @Override public Optional<? extends UserEntry> changePassword(String username, String newPassword) { Optional<User> user = findByUsername(username); if (user.isPresent()) { user.get().setPassword(newPassword); persist(user.get()); } return user; } @Inject  UserDao(SessionFactory sessionFactory); Optional<User> findByUsername(String username); List<User> findByRoleId(String roleId); @Override Optional<? extends UserEntry> changePassword(String username, String newPassword);  }### Answer:
@Test public void changePassword() { User user = super.createFrom(); String password = Hashing.sha256().hashString("321321", StandardCharsets.UTF_8).toString(); Optional<User> response = (Optional<User>) dao.changePassword(user.getUsername(), password); Assert.assertTrue(response.isPresent()); Assert.assertTrue(response.get().getPassword().equals(password)); super.deleteFrom(response.get()); password = Hashing.sha256().hashString("555555", StandardCharsets.UTF_8).toString(); response = (Optional<User>) dao.changePassword("none@robe.io", password); Assert.assertFalse(response.isPresent()); }