@Test
public void testBuildNotificationMessagesHappyPath() throws Exception
{

    // Create a business object data entity.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataServiceTestHelper
        .createTestValidBusinessObjectData(SUBPARTITION_VALUES, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(),
            businessObjectDefinitionServiceTestHelper.getNewAttributes());
    // Get a business object data key.
    BusinessObjectDataKey businessObjectDataKey = businessObjectDataHelper.getBusinessObjectDataKey(businessObjectDataEntity);
    // Override configuration.
    ConfigurationEntity configurationEntity = new ConfigurationEntity();
    configurationEntity.setKey(ConfigurationValue.HERD_NOTIFICATION_BUSINESS_OBJECT_DATA_STATUS_CHANGE_MESSAGE_DEFINITIONS.getKey());
    configurationEntity.setValueClob(xmlHelper.objectToXml(new NotificationMessageDefinitions(Collections.singletonList(
        new NotificationMessageDefinition(MESSAGE_TYPE_SNS, MESSAGE_DESTINATION,
            BUSINESS_OBJECT_DATA_STATUS_CHANGE_NOTIFICATION_MESSAGE_VELOCITY_TEMPLATE_XML, NO_MESSAGE_HEADER_DEFINITIONS)))));
    configurationDao.saveAndRefresh(configurationEntity);
    // Trigger the notification.
    List<NotificationMessage> result = notificationMessageManager.buildNotificationMessages(
        new BusinessObjectDataStatusChangeNotificationEvent(businessObjectDataKey, BusinessObjectDataStatusEntity.VALID,
            BusinessObjectDataStatusEntity.INVALID));
    // Validate the results.
    assertEquals(1, CollectionUtils.size(result));
    businessObjectDataServiceTestHelper
        .validateBusinessObjectDataStatusChangeMessageWithXmlPayload(MESSAGE_TYPE_SNS, MESSAGE_DESTINATION, businessObjectDataKey,
            businessObjectDataEntity.getId(), HerdDaoSecurityHelper.SYSTEM_USER, BusinessObjectDataStatusEntity.VALID,
            BusinessObjectDataStatusEntity.INVALID, Collections.singletonList(new Attribute(ATTRIBUTE_NAME_3_MIXED_CASE, ATTRIBUTE_VALUE_3)),
            NO_MESSAGE_HEADERS, result.get(0));
}