CredentialProtectionExtensionClientInput implements RegistrationExtensionClientInput { @Override public Serializable getValue(String key) { switch (key) { case KEY_CREDENTIAL_PROTECTION_POLICY: return credentialProtectionPolicy; case KEY_ENFORCE_CREDENTIAL_PROTECTION_POLICY: return enforceCredentialProtectionPolicy; default: throw new IllegalArgumentException(String.format("%s is not valid key.", key)); } } CredentialProtectionExtensionClientInput(
            CredentialProtectionPolicy credentialProtectionPolicy, Boolean enforceCredentialProtectionPolicy);  CredentialProtectionExtensionClientInput(CredentialProtectionPolicy credentialProtectionPolicy); @Override String getIdentifier(); CredentialProtectionPolicy getCredentialProtectionPolicy(); Boolean getEnforceCredentialProtectionPolicy(); @Override Serializable getValue(String key); @Override void validate(); static final String ID; static final String KEY_CREDENTIAL_PROTECTION_POLICY; static final String KEY_ENFORCE_CREDENTIAL_PROTECTION_POLICY; }
@Test void getValue_with_valid_key_test(){ CredentialProtectionExtensionClientInput target = new CredentialProtectionExtensionClientInput(CredentialProtectionPolicy.USER_VERIFICATION_OPTIONAL_WITH_CREDENTIAL_ID_LIST, true); assertThatCode(()->target.getValue("credentialProtectionPolicy")).doesNotThrowAnyException(); assertThatCode(()->target.getValue("enforceCredentialProtectionPolicy")).doesNotThrowAnyException(); }
@Test void getValue_with_invalid_key_test(){ CredentialProtectionExtensionClientInput target = new CredentialProtectionExtensionClientInput(CredentialProtectionPolicy.USER_VERIFICATION_OPTIONAL_WITH_CREDENTIAL_ID_LIST, true); assertThatThrownBy(()->target.getValue("invalid")).isInstanceOf(IllegalArgumentException.class); }