@Test
public void testUpdateBusinessObjectDataParentsListOfParentsIsNull()
{

    // Create a business object data key for the parent.
    BusinessObjectDataKey businessObjectDataParentKey =
        new BusinessObjectDataKey(NAMESPACE_2, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION, PARTITION_VALUE_2,
            SUBPARTITION_VALUES_2, DATA_VERSION);
    // Create a business object data key for the child.
    BusinessObjectDataKey businessObjectDataChildKey =
        new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES,
            DATA_VERSION);
    // Create business object data parent.
    BusinessObjectDataEntity businessObjectDataParentEntity =
        businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataParentKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);
    // Create a child business object data entity having a pre-registration status.
    BusinessObjectDataEntity businessObjectDataChildEntity = businessObjectDataDaoTestHelper
        .createBusinessObjectDataEntity(businessObjectDataChildKey, LATEST_VERSION_FLAG_SET, BusinessObjectDataStatusEntity.UPLOADING);
    // Associate child and parent business object data entities.
    businessObjectDataParentEntity.getBusinessObjectDataChildren().add(businessObjectDataChildEntity);
    businessObjectDataChildEntity.getBusinessObjectDataParents().add(businessObjectDataParentEntity);
    // Create a business object data parents update request with alist of parents passed as null.
    BusinessObjectDataParentsUpdateRequest businessObjectDataParentsUpdateRequest = new BusinessObjectDataParentsUpdateRequest(null);
    // Create a business object data.
    BusinessObjectData businessObjectData = new BusinessObjectData();
    businessObjectData.setId(ID);
    // Mock the external calls.
    when(businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataChildKey)).thenReturn(businessObjectDataChildEntity);
    when(businessObjectDataDao.saveAndRefresh(businessObjectDataChildEntity)).thenReturn(businessObjectDataChildEntity);
    when(businessObjectDataHelper.createBusinessObjectDataFromEntity(businessObjectDataChildEntity)).thenReturn(businessObjectData);
    // Call the method under test.
    BusinessObjectData result =
        businessObjectDataServiceImpl.updateBusinessObjectDataParents(businessObjectDataChildKey, businessObjectDataParentsUpdateRequest);
    // Verify the external calls.
    verify(businessObjectDataHelper).validateBusinessObjectDataKey(businessObjectDataChildKey, true, true);
    verify(businessObjectDataDaoHelper).validateBusinessObjectDataKeys(businessObjectDataParentsUpdateRequest.getBusinessObjectDataParents());
    verify(businessObjectDataDaoHelper).getBusinessObjectDataEntity(businessObjectDataChildKey);
    verify(businessObjectDataDao).saveAndRefresh(businessObjectDataChildEntity);
    verify(businessObjectDataHelper).createBusinessObjectDataFromEntity(businessObjectDataChildEntity);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectData, result);
    // Validate the list of parents on the business object data entity.
    assertTrue(CollectionUtils.isEmpty(businessObjectDataChildEntity.getBusinessObjectDataParents()));
}