@Test
public void testValidateBusinessObjectDataInvalidPrimaryPartitionValue()
{

    // Create a version-less business object format key.
    BusinessObjectFormatKey businessObjectFormatKey =
        new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION);
    // Create a business object data key.
    BusinessObjectDataKey businessObjectDataKey =
        new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            NO_SUBPARTITION_VALUES, DATA_VERSION);
    // Create a retention type entity.
    RetentionTypeEntity retentionTypeEntity = new RetentionTypeEntity();
    retentionTypeEntity.setCode(RetentionTypeEntity.PARTITION_VALUE);
    // Create a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity();
    businessObjectFormatEntity.setLatestVersion(true);
    businessObjectFormatEntity.setRetentionType(retentionTypeEntity);
    businessObjectFormatEntity.setRetentionPeriodInDays(RETENTION_PERIOD_DAYS);
    // Create a business object data entity.
    BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity();
    businessObjectDataEntity.setBusinessObjectFormat(businessObjectFormatEntity);
    businessObjectDataEntity.setPartitionValue(PARTITION_VALUE);
    // Create a current timestamp.
    Timestamp currentTimestamp = new Timestamp(new Date().getTime());
    // Mock the external calls.
    when(businessObjectDataHelper.getDateFromString(PARTITION_VALUE)).thenReturn(null);
    when(businessObjectDataHelper.businessObjectDataKeyToString(businessObjectDataKey)).thenReturn(BUSINESS_OBJECT_DATA_KEY_AS_STRING);
    when(herdDao.getCurrentTimestamp()).thenReturn(currentTimestamp);
    // Try to call the method under test.
    try
    {
        businessObjectDataInitiateDestroyHelperServiceImpl.validateBusinessObjectData(businessObjectDataEntity, businessObjectDataKey);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("Primary partition value \"%s\" cannot get converted to a valid date. Business object data: {%s}", PARTITION_VALUE,
            BUSINESS_OBJECT_DATA_KEY_AS_STRING), e.getMessage());
    }
    // Verify the external calls.
    verify(businessObjectDataHelper).getDateFromString(PARTITION_VALUE);
    verify(businessObjectDataHelper).businessObjectDataKeyToString(businessObjectDataKey);
    verify(herdDao).getCurrentTimestamp();
    verifyNoMoreInteractionsHelper();
}