@Test public void test_updatePassword_success() throws BadPasswordException, UnauthorizedException { boolean success = adminManagerToTest.updatePassword(USERNAME, OLD_PW, NEW_PW); Assert.assertTrue(success); }
@Override public boolean updatePassword(String username, String oldPassword, String newPassword) throws BadPasswordException, UnauthorizedException { boolean valid = isPasswordValid(username, oldPassword); if (!valid) { throw new UnauthorizedException("Provided password is not valid."); } if (newPassword == null || newPassword.trim().isEmpty()) { throw new BadPasswordException("Password cannot be empty."); } return adminDetailsService.changePassword(username, newPassword); }
AdminUserManager implements IAdminUserManager { @Override public boolean updatePassword(String username, String oldPassword, String newPassword) throws BadPasswordException, UnauthorizedException { boolean valid = isPasswordValid(username, oldPassword); if (!valid) { throw new UnauthorizedException("Provided password is not valid."); } if (newPassword == null || newPassword.trim().isEmpty()) { throw new BadPasswordException("Password cannot be empty."); } return adminDetailsService.changePassword(username, newPassword); } }
AdminUserManager implements IAdminUserManager { @Override public boolean updatePassword(String username, String oldPassword, String newPassword) throws BadPasswordException, UnauthorizedException { boolean valid = isPasswordValid(username, oldPassword); if (!valid) { throw new UnauthorizedException("Provided password is not valid."); } if (newPassword == null || newPassword.trim().isEmpty()) { throw new BadPasswordException("Password cannot be empty."); } return adminDetailsService.changePassword(username, newPassword); }  }
AdminUserManager implements IAdminUserManager { @Override public boolean updatePassword(String username, String oldPassword, String newPassword) throws BadPasswordException, UnauthorizedException { boolean valid = isPasswordValid(username, oldPassword); if (!valid) { throw new UnauthorizedException("Provided password is not valid."); } if (newPassword == null || newPassword.trim().isEmpty()) { throw new BadPasswordException("Password cannot be empty."); } return adminDetailsService.changePassword(username, newPassword); }  @Override List<UserDetails> getAdministrators(); @Override boolean isPasswordValid(String username, String password); @Override boolean updatePassword(String username, String oldPassword, String newPassword); }
AdminUserManager implements IAdminUserManager { @Override public boolean updatePassword(String username, String oldPassword, String newPassword) throws BadPasswordException, UnauthorizedException { boolean valid = isPasswordValid(username, oldPassword); if (!valid) { throw new UnauthorizedException("Provided password is not valid."); } if (newPassword == null || newPassword.trim().isEmpty()) { throw new BadPasswordException("Password cannot be empty."); } return adminDetailsService.changePassword(username, newPassword); }  @Override List<UserDetails> getAdministrators(); @Override boolean isPasswordValid(String username, String password); @Override boolean updatePassword(String username, String oldPassword, String newPassword);  }