@Test
public void testGenerateReplaceColumnsStatement()
{

    BusinessObjectFormatDdlRequest businessObjectFormatDdlRequest = new BusinessObjectFormatDdlRequest();
    businessObjectFormatDdlRequest.setTableName(TABLE_NAME);
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper
        .createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION,
            FORMAT_DOCUMENT_SCHEMA, FORMAT_DOCUMENT_SCHEMA_URL, true, PARTITION_KEY);
    {
        SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
        schemaColumnEntity.setPosition(0);
        schemaColumnEntity.setName("col1");
        schemaColumnEntity.setType("varchar");
        schemaColumnEntity.setSize("255");
        schemaColumnEntity.setDescription("lorem ipsum");
        businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
    }
    {
        SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
        schemaColumnEntity.setPosition(1);
        schemaColumnEntity.setName("col2");
        schemaColumnEntity.setType("date");
        businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
    }
    {
        SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
        schemaColumnEntity.setPosition(2);
        schemaColumnEntity.setName("col3");
        // Use complex schema data type with whitespaces in it.
        // Expect the whitespaces to be removed whilke validating the complex data types.
        schemaColumnEntity.setType("map <double, array<bigint(5)>>");
        businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
    }
    {
        SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
        schemaColumnEntity.setPosition(3);
        schemaColumnEntity.setName("col4");
        schemaColumnEntity.setType("uniontype<int,double,array<string>,struct<a:int,b:string>>");
        businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
    }
    {
        SchemaColumnEntity schemaColumnEntity = new SchemaColumnEntity();
        schemaColumnEntity.setPosition(3);
        schemaColumnEntity.setName("col4");
        schemaColumnEntity.setType("struct<s:string,f:float,m:map<double,array<bigint>>>");
        businessObjectFormatEntity.getSchemaColumns().add(schemaColumnEntity);
    }
    String actual = hive13DdlGenerator.generateReplaceColumnsStatement(businessObjectFormatDdlRequest, businessObjectFormatEntity);
    String expected =
        "ALTER TABLE `" + businessObjectFormatDdlRequest.getTableName() + "` REPLACE COLUMNS (\n" + "    `col1` VARCHAR(255) COMMENT 'lorem ipsum',\n" +
            "    `col2` DATE,\n" + "    `col3` map<double,array<bigint(5)>>,\n" +
            "    `col4` uniontype<int,double,array<string>,struct<a:int,b:string>>,\n" +
            "    `col4` struct<s:string,f:float,m:map<double,array<bigint>>>);";
    Assert.assertEquals("generated DDL", expected, actual);
}