@Test
public void testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities()
{

    // Create a velocity template for the external interface entity.
    String velocityTemplateDescription = "${namespace}#${businessObjectDefinitionName}#${businessObjectFormatUsage}#${businessObjectFormatFileType}#" +
        "${businessObjectFormatAttributes}#${partitionColumnNames}#${partitionKeyGroup}#$StringUtils.isNotEmpty($namespace)";
    // Get a list of partition columns that is larger than number of partitions supported by business object data registration.
    List<SchemaColumn> partitionColumns = schemaColumnDaoTestHelper.getTestPartitionColumns();
    assertTrue(CollectionUtils.size(partitionColumns) > BusinessObjectDataEntity.MAX_SUBPARTITIONS + 1);
    // Get a list of regular columns.
    List<SchemaColumn> regularColumns = schemaColumnDaoTestHelper.getTestSchemaColumns();
    // Create a list of attributes
    List<Attribute> attributes = Lists.newArrayList(new Attribute(ATTRIBUTE_NAME, ATTRIBUTE_VALUE), new Attribute(ATTRIBUTE_NAME_2, ATTRIBUTE_VALUE_2));
    // Create a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper
        .createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION,
            NO_FORMAT_DOCUMENT_SCHEMA, NO_FORMAT_DOCUMENT_SCHEMA_URL, LATEST_VERSION_FLAG_SET, partitionColumns.get(0).getName(), PARTITION_KEY_GROUP,
            attributes, SCHEMA_DELIMITER_PIPE, SCHEMA_COLLECTION_ITEMS_DELIMITER_COMMA, SCHEMA_MAP_KEYS_DELIMITER_HASH, SCHEMA_ESCAPE_CHARACTER_BACKSLASH,
            null, null, SCHEMA_NULL_VALUE_BACKSLASH_N, regularColumns, partitionColumns);
    // Create an external interface entity.
    ExternalInterfaceEntity externalInterfaceEntity = externalInterfaceDaoTestHelper.createExternalInterfaceEntity(EXTERNAL_INTERFACE);
    externalInterfaceEntity.setDisplayName(DISPLAY_NAME_FIELD);
    externalInterfaceEntity.setDescription(velocityTemplateDescription);
    // Create a business object format to external interface mapping entity.
    businessObjectFormatExternalInterfaceDaoTestHelper
        .createBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatEntity, externalInterfaceEntity);
    // Call the method under test.
    BusinessObjectFormatExternalInterfaceDescriptiveInformation result = businessObjectFormatExternalInterfaceDescriptiveInformationHelper
        .createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(businessObjectFormatEntity, externalInterfaceEntity);
    // Validate the results.
    assertEquals(result.getBusinessObjectFormatExternalInterfaceKey().getNamespace(), NAMESPACE);
    assertEquals(result.getBusinessObjectFormatExternalInterfaceKey().getBusinessObjectDefinitionName(), BDEF_NAME);
    assertEquals(result.getBusinessObjectFormatExternalInterfaceKey().getBusinessObjectFormatUsage(), FORMAT_USAGE_CODE);
    assertEquals(result.getBusinessObjectFormatExternalInterfaceKey().getBusinessObjectFormatFileType(), FORMAT_FILE_TYPE_CODE);
    assertEquals(result.getBusinessObjectFormatExternalInterfaceKey().getExternalInterfaceName(), EXTERNAL_INTERFACE);
    assertEquals(result.getExternalInterfaceDisplayName(), DISPLAY_NAME_FIELD);
    String[] descriptionTemplateReplacementValues = result.getExternalInterfaceDescription().split("#");
    // ${namespace}
    assertEquals("Namespace not equal to replacement.", descriptionTemplateReplacementValues[0], NAMESPACE);
    // ${businessObjectDefinitionName}
    assertEquals("Business object definition name not equal to replacement.", descriptionTemplateReplacementValues[1], BDEF_NAME);
    // ${businessObjectFormatUsage}
    assertEquals("Usage not equal to replacement.", descriptionTemplateReplacementValues[2], FORMAT_USAGE_CODE);
    // ${businessObjectFormatFileType}
    assertEquals("File type not equal to replacement.", descriptionTemplateReplacementValues[3], FORMAT_FILE_TYPE_CODE);
    // ${businessObjectFormatAttributes}
    Map<String, String> attributesMap = Maps.newLinkedHashMap();
    for (Attribute attribute : attributes)
    {
        attributesMap.put(attribute.getName(), attribute.getValue());
    }
    assertEquals("Attributes not equal to replacement.", descriptionTemplateReplacementValues[4], attributesMap.toString());
    // ${partitionColumnNames}
    List<String> partitionColumnNames = Lists.newArrayList();
    for (SchemaColumnEntity schemaColumn : businessObjectFormatEntity.getSchemaColumns())
    {
        if (schemaColumn.getPartitionLevel() != null)
        {
            partitionColumnNames.add(schemaColumn.getName());
        }
    }
    assertEquals("Partitions not equal to replacement.", descriptionTemplateReplacementValues[5], partitionColumnNames.toString());
    // ${partitionKeyGroup}
    assertEquals("Partition key group not equal to replacement.", descriptionTemplateReplacementValues[6], PARTITION_KEY_GROUP);
    // $StringUtils
    assertEquals("StringUtils not equal to replacement.", descriptionTemplateReplacementValues[7], "true");
}