@Test
public void testDeleteBusinessObjectData()
{

    // Create a list of business object data keys with all possible number of sub-partition values.
    List<BusinessObjectDataKey> businessObjectDataKeys = new ArrayList<>();
    for (int subPartitionValuesCount = 0; subPartitionValuesCount <= SUBPARTITION_VALUES.size(); subPartitionValuesCount++)
    {
        businessObjectDataKeys.add(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES.subList(0, subPartitionValuesCount), DATA_VERSION));
    }
    // Create a list of business object data instances one per business object data key.
    List<BusinessObjectData> businessObjectDataList = new ArrayList<>();
    for (BusinessObjectDataKey businessObjectDataKey : businessObjectDataKeys)
    {
        BusinessObjectData businessObjectData = new BusinessObjectData();
        businessObjectData.setNamespace(businessObjectDataKey.getNamespace());
        businessObjectData.setBusinessObjectDefinitionName(businessObjectDataKey.getBusinessObjectDefinitionName());
        businessObjectData.setBusinessObjectFormatUsage(businessObjectDataKey.getBusinessObjectFormatUsage());
        businessObjectData.setBusinessObjectFormatFileType(businessObjectDataKey.getBusinessObjectFormatFileType());
        businessObjectData.setBusinessObjectFormatVersion(businessObjectDataKey.getBusinessObjectFormatVersion());
        businessObjectData.setPartitionValue(businessObjectDataKey.getPartitionValue());
        businessObjectData.setSubPartitionValues(businessObjectDataKey.getSubPartitionValues());
        businessObjectData.setVersion(businessObjectDataKey.getBusinessObjectDataVersion());
        businessObjectDataList.add(businessObjectData);
    }
    // Mock the external calls.
    for (int subPartitionValuesCount = 0; subPartitionValuesCount <= SUBPARTITION_VALUES.size(); subPartitionValuesCount++)
    {
        when(businessObjectDataService.deleteBusinessObjectData(businessObjectDataKeys.get(subPartitionValuesCount), DELETE_FILES))
            .thenReturn(businessObjectDataList.get(subPartitionValuesCount));
    }
    // Call the methods under test and validate the results.
    assertEquals(businessObjectDataList.get(0), businessObjectDataRestController
        .deleteBusinessObjectData(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION,
            DELETE_FILES));
    assertEquals(businessObjectDataList.get(1), businessObjectDataRestController
        .deleteBusinessObjectData(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES.get(0), DATA_VERSION, DELETE_FILES));
    assertEquals(businessObjectDataList.get(2), businessObjectDataRestController
        .deleteBusinessObjectData(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), DATA_VERSION, DELETE_FILES));
    assertEquals(businessObjectDataList.get(3), businessObjectDataRestController
        .deleteBusinessObjectData(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), DATA_VERSION, DELETE_FILES));
    assertEquals(businessObjectDataList.get(4), businessObjectDataRestController
        .deleteBusinessObjectData(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3), DATA_VERSION, DELETE_FILES));
    // Verify the external calls.
    for (BusinessObjectDataKey businessObjectDataKey : businessObjectDataKeys)
    {
        verify(businessObjectDataService).deleteBusinessObjectData(businessObjectDataKey, DELETE_FILES);
    }
    verifyNoMoreInteractionsHelper();
}