@Test void testUpdatePasswordPolicyShouldUpdateAllPropertyWhenAllExistingPropertyIsNull() throws FreeIpaClientException { PasswordPolicy passwordPolicy = new PasswordPolicy(); when(freeIpaClient.getPasswordPolicy()).thenReturn(passwordPolicy); underTest.updatePasswordPolicy(freeIpaClient); verify(freeIpaClient).getPasswordPolicy(); ArgumentCaptor<Map<String, Object>> paramCaptor = ArgumentCaptor.forClass(Map.class); verify(freeIpaClient).updatePasswordPolicy(paramCaptor.capture()); Map<String, Object> captorValue = paramCaptor.getValue(); Assert.assertEquals(MIN_PASSWORD_LENGTH_VALUE, captorValue.get(MIN_PASSWORD_LENGTH)); Assert.assertEquals(MIN_CHARACTER_CLASSES_VALUE, captorValue.get(MIN_CHARACTER_CLASSES)); Assert.assertEquals(MAX_PASSWORD_LIFETIME_DAYS_VALUE, captorValue.get(MAX_PASSWORD_LIFETIME_DAYS)); Assert.assertEquals(MAX_FAILURES_BEFORE_LOCK_VALUE, captorValue.get(MAX_FAILURES_BEFORE_LOCK)); Assert.assertEquals(FAILURE_RESET_INTERVALL_SECONDS_VALUE, captorValue.get(FAILURE_RESET_INTERVALL_SECONDS)); Assert.assertEquals(LOCKOUT_DURATION_SECONDS_VALUE, captorValue.get(LOCKOUT_DURATION_SECONDS)); }
void updatePasswordPolicy(FreeIpaClient freeIpaClient) throws FreeIpaClientException { PasswordPolicy config = freeIpaClient.getPasswordPolicy(); Map<String, Object> params = getParameters(config); if (!params.isEmpty()) { freeIpaClient.updatePasswordPolicy(params); } }
PasswordPolicyService { void updatePasswordPolicy(FreeIpaClient freeIpaClient) throws FreeIpaClientException { PasswordPolicy config = freeIpaClient.getPasswordPolicy(); Map<String, Object> params = getParameters(config); if (!params.isEmpty()) { freeIpaClient.updatePasswordPolicy(params); } } }
PasswordPolicyService { void updatePasswordPolicy(FreeIpaClient freeIpaClient) throws FreeIpaClientException { PasswordPolicy config = freeIpaClient.getPasswordPolicy(); Map<String, Object> params = getParameters(config); if (!params.isEmpty()) { freeIpaClient.updatePasswordPolicy(params); } }  }
PasswordPolicyService { void updatePasswordPolicy(FreeIpaClient freeIpaClient) throws FreeIpaClientException { PasswordPolicy config = freeIpaClient.getPasswordPolicy(); Map<String, Object> params = getParameters(config); if (!params.isEmpty()) { freeIpaClient.updatePasswordPolicy(params); } }   }
PasswordPolicyService { void updatePasswordPolicy(FreeIpaClient freeIpaClient) throws FreeIpaClientException { PasswordPolicy config = freeIpaClient.getPasswordPolicy(); Map<String, Object> params = getParameters(config); if (!params.isEmpty()) { freeIpaClient.updatePasswordPolicy(params); } }    }