@Test public void testDisabledPasswordHistory() throws Exception { User user = getTestUser(); Tree userTree = root.getTree(user.getPath()); List<ConfigurationParameters> configs = ImmutableList.of( ConfigurationParameters.EMPTY, ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, PASSWORD_HISTORY_DISABLED_SIZE), ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, -1), ConfigurationParameters.of(PARAM_PASSWORD_HISTORY_SIZE, Integer.MIN_VALUE) ); for (ConfigurationParameters config : configs) { PasswordHistory disabledHistory = new PasswordHistory(config); assertFalse(isEnabled(disabledHistory)); assertFalse(disabledHistory.updatePasswordHistory(userTree, user.getID())); } }
boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config); }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config);  }
PasswordHistory implements UserConstants { boolean updatePasswordHistory(@NotNull Tree userTree, @NotNull String password) throws ConstraintViolationException, AccessDeniedException { boolean updated = false; if (isEnabled) { checkPasswordInHistory(userTree, password); updated = shiftPasswordHistory(userTree); } return updated; } PasswordHistory(@NotNull ConfigurationParameters config);   }