test_class.declarator: builder
test_class.original_string: ValidationChainBuilder builder;
test_class.type: ValidationChainBuilder
test_class.var_name: builder
test_class.declarator: testchain
test_class.original_string: ValidationChain testchain;
test_class.type: ValidationChain
test_class.var_name: testchain
test_class.declarator: user
test_class.original_string: UserProfile user;
test_class.type: UserProfile
test_class.var_name: user
test_class.declarator: updateContext
test_class.original_string: DefaultUserProfileContext updateContext;
test_class.type: DefaultUserProfileContext
test_class.var_name: updateContext
test_class.declarator: rep = new UserRepresentation()
test_class.original_string: UserRepresentation rep = new UserRepresentation();
test_class.type: UserRepresentation
test_class.var_name: rep
test_class.file: services/src/test/java/org/keycloak/userprofile/validation/ValidationChainTest.java
test_class.identifier: ValidationChainTest
test_case.body: @Test
      public void mergedConfig() {
          testchain = builder.addAttributeValidator().forAttribute("FAKE_FIELD")
                  .addValidationFunction("FAKE_FIELD_ERRORKEY_1", (value, updateUserProfileContext) -> false).build()
                  .addAttributeValidator().forAttribute("FAKE_FIELD")
                  .addValidationFunction("FAKE_FIELD_ERRORKEY_2", (value, updateUserProfileContext) -> false).build().build();
  
          UserProfileValidationResult results = new UserProfileValidationResult(testchain.validate(updateContext, new UserRepresentationUserProfile(rep)));
          Assert.assertEquals(true, results.hasFailureOfErrorType("FAKE_FIELD_ERRORKEY_1"));
          Assert.assertEquals(true, results.hasFailureOfErrorType("FAKE_FIELD_ERRORKEY_2"));
          Assert.assertEquals(true, results.getValidationResults().stream().filter(o -> o.getField().equals("firstName")).collect(Collectors.toList()).get(0).isValid());
          Assert.assertEquals(false, results.hasAttributeChanged("firstName"));
  
      }
test_case.class_method_signature: ValidationChainTest.mergedConfig()
test_case.full_signature: @Test public void mergedConfig()
test_case.identifier: mergedConfig
test_case.invocations: build build addValidationFunction forAttribute addAttributeValidator build addValidationFunction forAttribute addAttributeValidator validate assertEquals hasFailureOfErrorType assertEquals hasFailureOfErrorType assertEquals isValid get collect filter stream getValidationResults equals getField toList assertEquals hasAttributeChanged
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void mergedConfig()
focal_class.declarator: attributeValidators
focal_class.original_string: List<AttributeValidator> attributeValidators;
focal_class.type: List<AttributeValidator>
focal_class.var_name: attributeValidators
focal_class.file: services/src/main/java/org/keycloak/userprofile/validation/ValidationChain.java
focal_class.identifier: ValidationChain
focal_class.class_method_signature: ValidationChain.ValidationChain(List<AttributeValidator> attributeValidators)
focal_class.full_signature: public  ValidationChain(List<AttributeValidator> attributeValidators)
focal_class.identifier: ValidationChain
focal_class.modifiers: public
focal_class.parameters: (List<AttributeValidator> attributeValidators)
focal_class.signature:  ValidationChain(List<AttributeValidator> attributeValidators)
focal_class.class_method_signature: ValidationChain.validate(UserProfileContext updateContext, UserProfile updatedProfile)
focal_class.full_signature: public List<AttributeValidationResult> validate(UserProfileContext updateContext, UserProfile updatedProfile)
focal_class.identifier: validate
focal_class.modifiers: public
focal_class.parameters: (UserProfileContext updateContext, UserProfile updatedProfile)
focal_class.return: List<AttributeValidationResult>
focal_class.signature: List<AttributeValidationResult> validate(UserProfileContext updateContext, UserProfile updatedProfile)
focal_method.body: public List<AttributeValidationResult> validate(UserProfileContext updateContext, UserProfile updatedProfile) {
          List<AttributeValidationResult> overallResults = new ArrayList<>();
          for (AttributeValidator attribute : attributeValidators) {
              List<ValidationResult> validationResults = new ArrayList<>();
  
              String attributeKey = attribute.attributeKey;
              String attributeValue = updatedProfile.getAttributes().getFirstAttribute(attributeKey);
              boolean attributeChanged = false;
  
              if (attributeValue != null) {
                  attributeChanged = updateContext.getCurrentProfile() != null
                          && !attributeValue.equals(updateContext.getCurrentProfile().getAttributes().getFirstAttribute(attributeKey));
                  for (Validator validator : attribute.validators) {
                      validationResults.add(new ValidationResult(validator.function.apply(attributeValue, updateContext), validator.errorType));
                  }
              }
              overallResults.add(new AttributeValidationResult(attributeKey, attributeChanged, validationResults));
          }
  
          return overallResults;
      }
focal_method.class_method_signature: ValidationChain.validate(UserProfileContext updateContext, UserProfile updatedProfile)
focal_method.full_signature: public List<AttributeValidationResult> validate(UserProfileContext updateContext, UserProfile updatedProfile)
focal_method.identifier: validate
focal_method.invocations: getFirstAttribute getAttributes getCurrentProfile equals getFirstAttribute getAttributes getCurrentProfile add apply add
focal_method.modifiers: public
focal_method.parameters: (UserProfileContext updateContext, UserProfile updatedProfile)
focal_method.return: List<AttributeValidationResult>
focal_method.signature: List<AttributeValidationResult> validate(UserProfileContext updateContext, UserProfile updatedProfile)