test_class.declarator: businessObjectDataStatusChangeMessageBuilder
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private BusinessObjectDataStatusChangeMessageBuilder businessObjectDataStatusChangeMessageBuilder;
test_class.type: BusinessObjectDataStatusChangeMessageBuilder
test_class.var_name: businessObjectDataStatusChangeMessageBuilder
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/notification/BusinessObjectDataStatusChangeMessageBuilderTest.java
test_class.identifier: BusinessObjectDataStatusChangeMessageBuilderTest
test_class.superclass: extends AbstractNotificationMessageBuilderTestHelper
test_case.body: @Test
      public void testGetBusinessObjectDataStatusChangeMessageVelocityContextMap()
      {
          // Create a business object data key with values that require JSON and XML escaping.
          BusinessObjectDataKey businessObjectDataKey =
              new BusinessObjectDataKey(BDEF_NAMESPACE + SUFFIX_UNESCAPED, BDEF_NAME + SUFFIX_UNESCAPED, FORMAT_USAGE_CODE + SUFFIX_UNESCAPED,
                  FORMAT_FILE_TYPE_CODE + SUFFIX_UNESCAPED, FORMAT_VERSION, PARTITION_VALUE + SUFFIX_UNESCAPED, Lists
                  .newArrayList(SUBPARTITION_VALUES.get(0) + SUFFIX_UNESCAPED, SUBPARTITION_VALUES.get(1) + SUFFIX_UNESCAPED,
                      SUBPARTITION_VALUES.get(2) + SUFFIX_UNESCAPED, SUBPARTITION_VALUES.get(3) + SUFFIX_UNESCAPED), DATA_VERSION);
  
          // Create a list of attributes that require JSON and XML escaping.
          // An attribute with a null value is required for code coverage.
          List<Attribute> attributes = new ArrayList<>();
          attributes.add(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE + SUFFIX_UNESCAPED, ATTRIBUTE_VALUE_1 + SUFFIX_UNESCAPED));
          attributes.add(new Attribute(ATTRIBUTE_NAME_2_MIXED_CASE + SUFFIX_UNESCAPED, ATTRIBUTE_VALUE_2 + SUFFIX_UNESCAPED));
          attributes.add(new Attribute(ATTRIBUTE_NAME_3_MIXED_CASE + SUFFIX_UNESCAPED, null));
  
          // Create and persist a business object data entity.
          BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoTestHelper
              .createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.VALID);
  
          // Create and persist business object data attribute entities.
          for (Attribute attribute : attributes)
          {
              businessObjectDataAttributeDaoTestHelper
                  .createBusinessObjectDataAttributeEntity(businessObjectDataEntity, attribute.getName(), attribute.getValue());
          }
  
          // Add business object data attribute definitions to the business object format.
          for (Attribute attribute : attributes)
          {
              businessObjectFormatDaoTestHelper
                  .createBusinessObjectDataAttributeDefinitionEntity(businessObjectDataEntity.getBusinessObjectFormat(), attribute.getName(), PUBLISH_ATTRIBUTE, NO_PUBLISH_FOR_FILTER);
          }
  
          // Call the method under test.
          Map<String, Object> result = businessObjectDataStatusChangeMessageBuilder.getNotificationMessageVelocityContextMap(
              new BusinessObjectDataStatusChangeNotificationEvent(businessObjectDataKey, BDATA_STATUS_2 + SUFFIX_UNESCAPED, BDATA_STATUS + SUFFIX_UNESCAPED));
  
          // Create a map of expected businessObjectDataAttributes.
          Map<String, String> expectedBusinessObjectDataAttributes = new LinkedHashMap<>();
          expectedBusinessObjectDataAttributes.put(ATTRIBUTE_NAME_1_MIXED_CASE + SUFFIX_UNESCAPED, ATTRIBUTE_VALUE_1 + SUFFIX_UNESCAPED);
          expectedBusinessObjectDataAttributes.put(ATTRIBUTE_NAME_2_MIXED_CASE + SUFFIX_UNESCAPED, ATTRIBUTE_VALUE_2 + SUFFIX_UNESCAPED);
          expectedBusinessObjectDataAttributes.put(ATTRIBUTE_NAME_3_MIXED_CASE + SUFFIX_UNESCAPED, null);
  
          // Create a map of expected businessObjectDataAttributes.
          Map<String, String> expectedBusinessObjectDataAttributesWithJson = new LinkedHashMap<>();
          expectedBusinessObjectDataAttributesWithJson.put(ATTRIBUTE_NAME_1_MIXED_CASE + SUFFIX_ESCAPED_JSON, ATTRIBUTE_VALUE_1 + SUFFIX_ESCAPED_JSON);
          expectedBusinessObjectDataAttributesWithJson.put(ATTRIBUTE_NAME_2_MIXED_CASE + SUFFIX_ESCAPED_JSON, ATTRIBUTE_VALUE_2 + SUFFIX_ESCAPED_JSON);
          expectedBusinessObjectDataAttributesWithJson.put(ATTRIBUTE_NAME_3_MIXED_CASE + SUFFIX_ESCAPED_JSON, null);
  
          // Create a map of expected XML escaped businessObjectDataAttributes.
          Map<String, String> expectedBusinessObjectDataAttributesWithXml = new LinkedHashMap<>();
          expectedBusinessObjectDataAttributesWithXml.put(ATTRIBUTE_NAME_1_MIXED_CASE + SUFFIX_ESCAPED_XML, ATTRIBUTE_VALUE_1 + SUFFIX_ESCAPED_XML);
          expectedBusinessObjectDataAttributesWithXml.put(ATTRIBUTE_NAME_2_MIXED_CASE + SUFFIX_ESCAPED_XML, ATTRIBUTE_VALUE_2 + SUFFIX_ESCAPED_XML);
          expectedBusinessObjectDataAttributesWithXml.put(ATTRIBUTE_NAME_3_MIXED_CASE + SUFFIX_ESCAPED_XML, null);
  
          // Create an expected JSON escaped business object data key.
          BusinessObjectDataKey expectedBusinessObjectDataKeyWithJson =
              new BusinessObjectDataKey(BDEF_NAMESPACE + SUFFIX_ESCAPED_JSON, BDEF_NAME + SUFFIX_ESCAPED_JSON, FORMAT_USAGE_CODE + SUFFIX_ESCAPED_JSON,
                  FORMAT_FILE_TYPE_CODE + SUFFIX_ESCAPED_JSON, FORMAT_VERSION, PARTITION_VALUE + SUFFIX_ESCAPED_JSON, Lists
                  .newArrayList(SUBPARTITION_VALUES.get(0) + SUFFIX_ESCAPED_JSON, SUBPARTITION_VALUES.get(1) + SUFFIX_ESCAPED_JSON,
                      SUBPARTITION_VALUES.get(2) + SUFFIX_ESCAPED_JSON, SUBPARTITION_VALUES.get(3) + SUFFIX_ESCAPED_JSON), DATA_VERSION);
  
          // Create an expected XML escaped business object data key.
          BusinessObjectDataKey expectedBusinessObjectDataKeyWithXml =
              new BusinessObjectDataKey(BDEF_NAMESPACE + SUFFIX_ESCAPED_XML, BDEF_NAME + SUFFIX_ESCAPED_XML, FORMAT_USAGE_CODE + SUFFIX_ESCAPED_XML,
                  FORMAT_FILE_TYPE_CODE + SUFFIX_ESCAPED_XML, FORMAT_VERSION, PARTITION_VALUE + SUFFIX_ESCAPED_XML, Lists
                  .newArrayList(SUBPARTITION_VALUES.get(0) + SUFFIX_ESCAPED_XML, SUBPARTITION_VALUES.get(1) + SUFFIX_ESCAPED_XML,
                      SUBPARTITION_VALUES.get(2) + SUFFIX_ESCAPED_XML, SUBPARTITION_VALUES.get(3) + SUFFIX_ESCAPED_XML), DATA_VERSION);
  
          // Validate the results.
          assertEquals(16, CollectionUtils.size(result));
  
          assertEquals(businessObjectDataKey, result.get("businessObjectDataKey"));
          assertEquals(expectedBusinessObjectDataKeyWithJson, result.get("businessObjectDataKeyWithJson"));
          assertEquals(expectedBusinessObjectDataKeyWithXml, result.get("businessObjectDataKeyWithXml"));
  
          assertEquals(BDATA_STATUS_2 + SUFFIX_UNESCAPED, result.get("newBusinessObjectDataStatus"));
          assertEquals(BDATA_STATUS_2 + SUFFIX_ESCAPED_JSON, result.get("newBusinessObjectDataStatusWithJson"));
          assertEquals(BDATA_STATUS_2 + SUFFIX_ESCAPED_XML, result.get("newBusinessObjectDataStatusWithXml"));
  
          assertEquals(BDATA_STATUS + SUFFIX_UNESCAPED, result.get("oldBusinessObjectDataStatus"));
          assertEquals(BDATA_STATUS + SUFFIX_ESCAPED_JSON, result.get("oldBusinessObjectDataStatusWithJson"));
          assertEquals(BDATA_STATUS + SUFFIX_ESCAPED_XML, result.get("oldBusinessObjectDataStatusWithXml"));
  
          assertEquals(businessObjectDataEntity.getId(), result.get("businessObjectDataId"));
  
          assertEquals(expectedBusinessObjectDataAttributes, result.get("businessObjectDataAttributes"));
          assertEquals(expectedBusinessObjectDataAttributesWithJson, result.get("businessObjectDataAttributesWithJson"));
          assertEquals(expectedBusinessObjectDataAttributesWithXml, result.get("businessObjectDataAttributesWithXml"));
  
          assertEquals(BDEF_NAMESPACE + SUFFIX_UNESCAPED, result.get("namespace"));
          assertEquals(BDEF_NAMESPACE + SUFFIX_ESCAPED_JSON, result.get("namespaceWithJson"));
          assertEquals(BDEF_NAMESPACE + SUFFIX_ESCAPED_XML, result.get("namespaceWithXml"));
      }
test_case.class_method_signature: BusinessObjectDataStatusChangeMessageBuilderTest.testGetBusinessObjectDataStatusChangeMessageVelocityContextMap()
test_case.full_signature: @Test public void testGetBusinessObjectDataStatusChangeMessageVelocityContextMap()
test_case.identifier: testGetBusinessObjectDataStatusChangeMessageVelocityContextMap
test_case.invocations: newArrayList get get get get add add add createBusinessObjectDataEntity createBusinessObjectDataAttributeEntity getName getValue createBusinessObjectDataAttributeDefinitionEntity getBusinessObjectFormat getName getNotificationMessageVelocityContextMap put put put put put put put put put newArrayList get get get get newArrayList get get get get assertEquals size assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals getId get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetBusinessObjectDataStatusChangeMessageVelocityContextMap()
focal_class.declarator: businessObjectDataDaoHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectDataDaoHelper businessObjectDataDaoHelper;
focal_class.type: BusinessObjectDataDaoHelper
focal_class.var_name: businessObjectDataDaoHelper
focal_class.declarator: businessObjectFormatHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectFormatHelper businessObjectFormatHelper;
focal_class.type: BusinessObjectFormatHelper
focal_class.var_name: businessObjectFormatHelper
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/notification/BusinessObjectDataStatusChangeMessageBuilder.java
focal_class.identifier: BusinessObjectDataStatusChangeMessageBuilder
focal_class.interfaces: implements NotificationMessageBuilder
focal_class.class_method_signature: BusinessObjectDataStatusChangeMessageBuilder.getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
focal_class.full_signature: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The NotificationEvent is cast to a BusinessObjectDataStatusChangeNotificationEvent which is always the case since" + " we manage the event type to a builder in a map defined in NotificationMessageManager") public Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
focal_class.identifier: getNotificationMessageVelocityContextMap
focal_class.modifiers: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The NotificationEvent is cast to a BusinessObjectDataStatusChangeNotificationEvent which is always the case since" + " we manage the event type to a builder in a map defined in NotificationMessageManager") public
focal_class.parameters: (NotificationEvent notificationEvent)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
focal_class.class_method_signature: BusinessObjectDataStatusChangeMessageBuilder.escapeXmlBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.full_signature: private BusinessObjectDataKey escapeXmlBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.identifier: escapeXmlBusinessObjectDataKey
focal_class.modifiers: private
focal_class.parameters: (final BusinessObjectDataKey businessObjectDataKey)
focal_class.return: BusinessObjectDataKey
focal_class.signature: BusinessObjectDataKey escapeXmlBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.class_method_signature: BusinessObjectDataStatusChangeMessageBuilder.escapeJsonBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.full_signature: private BusinessObjectDataKey escapeJsonBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.identifier: escapeJsonBusinessObjectDataKey
focal_class.modifiers: private
focal_class.parameters: (final BusinessObjectDataKey businessObjectDataKey)
focal_class.return: BusinessObjectDataKey
focal_class.signature: BusinessObjectDataKey escapeJsonBusinessObjectDataKey(final BusinessObjectDataKey businessObjectDataKey)
focal_class.superclass: extends AbstractNotificationMessageBuilder
focal_method.body: @Override
      @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification =
          "The NotificationEvent is cast to a BusinessObjectDataStatusChangeNotificationEvent which is always the case since" +
              " we manage the event type to a builder in a map defined in NotificationMessageManager")
      public Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
      {
          BusinessObjectDataStatusChangeNotificationEvent event = (BusinessObjectDataStatusChangeNotificationEvent) notificationEvent;
  
          // Create a context map of values that can be used when building the message.
          Map<String, Object> velocityContextMap = new HashMap<>();
          addObjectPropertyToContext(velocityContextMap, "businessObjectDataKey", event.getBusinessObjectDataKey(),
              escapeJsonBusinessObjectDataKey(event.getBusinessObjectDataKey()), escapeXmlBusinessObjectDataKey(event.getBusinessObjectDataKey()));
          addStringPropertyToContext(velocityContextMap, "newBusinessObjectDataStatus", event.getNewBusinessObjectDataStatus());
          addStringPropertyToContext(velocityContextMap, "oldBusinessObjectDataStatus", event.getOldBusinessObjectDataStatus());
  
          // Retrieve business object data entity and business object data id to the context.
          BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoHelper.getBusinessObjectDataEntity(event.getBusinessObjectDataKey());
          velocityContextMap.put("businessObjectDataId", businessObjectDataEntity.getId());
  
          BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectDataEntity.getBusinessObjectFormat();
  
          // Load all attribute definitions for this business object data in a map for easy access.
          Map<String, BusinessObjectDataAttributeDefinitionEntity> attributeDefinitionEntityMap =
              businessObjectFormatHelper.getAttributeDefinitionEntities(businessObjectFormatEntity);
  
          // Build an ordered map of business object data attributes that are flagged to be published in notification messages.
          Map<String, String> businessObjectDataAttributes = new LinkedHashMap<>();
          Map<String, String> businessObjectDataAttributesWithJson = new LinkedHashMap<>();
          Map<String, String> businessObjectDataAttributesWithXml = new LinkedHashMap<>();
          if (!attributeDefinitionEntityMap.isEmpty())
          {
              for (BusinessObjectDataAttributeEntity attributeEntity : businessObjectDataEntity.getAttributes())
              {
                  if (attributeDefinitionEntityMap.containsKey(attributeEntity.getName().toUpperCase()))
                  {
                      BusinessObjectDataAttributeDefinitionEntity attributeDefinitionEntity =
                          attributeDefinitionEntityMap.get(attributeEntity.getName().toUpperCase());
  
                      if (BooleanUtils.isTrue(attributeDefinitionEntity.getPublish()))
                      {
                          businessObjectDataAttributes.put(attributeEntity.getName(), attributeEntity.getValue());
                          businessObjectDataAttributesWithJson.put(escapeJson(attributeEntity.getName()), escapeJson(attributeEntity.getValue()));
                          businessObjectDataAttributesWithXml.put(escapeXml(attributeEntity.getName()), escapeXml(attributeEntity.getValue()));
                      }
  
                      if (BooleanUtils.isTrue(attributeDefinitionEntity.getPublishForFilter()))
                      {
  
                          // Get notification header key for filter attribute value
                          String filterAttributeKey = configurationHelper.getRequiredProperty(ConfigurationValue.MESSAGE_HEADER_KEY_FILTER_ATTRIBUTE_VALUE);
                          if (velocityContextMap.containsKey(filterAttributeKey))
                          {
                              throw new IllegalStateException(String.format("Multiple attributes are marked as publishForFilter for business object format {%s}.",
                                      businessObjectFormatHelper.businessObjectFormatEntityAltKeyToString(businessObjectFormatEntity)));
                          }
  
                          addStringPropertyToContext(velocityContextMap, filterAttributeKey, attributeEntity.getValue());
                      }
                  }
              }
          }
  
          // Add the map of business object data attributes to the context.
          addObjectPropertyToContext(velocityContextMap, "businessObjectDataAttributes", businessObjectDataAttributes, businessObjectDataAttributesWithJson,
              businessObjectDataAttributesWithXml);
  
          // Add the namespace Velocity property for the header.
          addStringPropertyToContext(velocityContextMap, "namespace", event.getBusinessObjectDataKey().getNamespace());
  
          return velocityContextMap;
      }
focal_method.class_method_signature: BusinessObjectDataStatusChangeMessageBuilder.getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
focal_method.full_signature: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The NotificationEvent is cast to a BusinessObjectDataStatusChangeNotificationEvent which is always the case since" + " we manage the event type to a builder in a map defined in NotificationMessageManager") public Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
focal_method.identifier: getNotificationMessageVelocityContextMap
focal_method.invocations: addObjectPropertyToContext getBusinessObjectDataKey escapeJsonBusinessObjectDataKey getBusinessObjectDataKey escapeXmlBusinessObjectDataKey getBusinessObjectDataKey addStringPropertyToContext getNewBusinessObjectDataStatus addStringPropertyToContext getOldBusinessObjectDataStatus getBusinessObjectDataEntity getBusinessObjectDataKey put getId getBusinessObjectFormat getAttributeDefinitionEntities isEmpty getAttributes containsKey toUpperCase getName get toUpperCase getName isTrue getPublish put getName getValue put escapeJson getName escapeJson getValue put escapeXml getName escapeXml getValue isTrue getPublishForFilter getRequiredProperty containsKey format businessObjectFormatEntityAltKeyToString addStringPropertyToContext getValue addObjectPropertyToContext addStringPropertyToContext getNamespace getBusinessObjectDataKey
focal_method.modifiers: @Override @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "The NotificationEvent is cast to a BusinessObjectDataStatusChangeNotificationEvent which is always the case since" + " we manage the event type to a builder in a map defined in NotificationMessageManager") public
focal_method.parameters: (NotificationEvent notificationEvent)
focal_method.return: Map<String, Object>
focal_method.signature: Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)