@Test
public void testGetAndValidateStorageUnitInvalidStorageUnitStatus()
{

    // 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 business object data entity.
    BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity();
    businessObjectDataEntity.setId(ID);
    // Create a storage entity.
    StorageEntity storageEntity = new StorageEntity();
    storageEntity.setName(STORAGE_NAME);
    // Create a storage unit status entity with an invalid value.
    StorageUnitStatusEntity storageUnitStatusEntity = new StorageUnitStatusEntity();
    storageUnitStatusEntity.setCode(INVALID_VALUE);
    // Create a storage unit entity with an invalid storage unit status.
    StorageUnitEntity storageUnitEntity = new StorageUnitEntity();
    storageUnitEntity.setStorage(storageEntity);
    storageUnitEntity.setStatus(storageUnitStatusEntity);
    // Mock the external calls.
    when(storageUnitDao.getStorageUnitsByStoragePlatformAndBusinessObjectData(StoragePlatformEntity.S3, businessObjectDataEntity))
        .thenReturn(Arrays.asList(storageUnitEntity));
    when(businessObjectDataHelper.businessObjectDataKeyToString(businessObjectDataKey)).thenReturn(BUSINESS_OBJECT_DATA_KEY_AS_STRING);
    // Try to call the method under test.
    try
    {
        businessObjectDataInitiateDestroyHelperServiceImpl.getAndValidateStorageUnit(businessObjectDataEntity, businessObjectDataKey);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String
            .format("Storage unit status \"%s\" is not supported by the business object data destroy feature. Storage: {%s}, business object data: {%s}",
                INVALID_VALUE, STORAGE_NAME, BUSINESS_OBJECT_DATA_KEY_AS_STRING), e.getMessage());
    }
    // Verify the external calls.
    verify(storageUnitDao).getStorageUnitsByStoragePlatformAndBusinessObjectData(StoragePlatformEntity.S3, businessObjectDataEntity);
    verify(businessObjectDataHelper).businessObjectDataKeyToString(businessObjectDataKey);
    verifyNoMoreInteractionsHelper();
}