@Test
public void testRetryStoragePolicyTransitionStorageUnitNotInArchivingState()
{

    // 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, SUBPARTITION_VALUES,
            DATA_VERSION);
    // Create a storage policy key.
    StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME);
    // Create database entities required for testing with a storage unit not in ARCHIVING state.
    businessObjectDataServiceTestHelper
        .createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKey, STORAGE_NAME, S3_BUCKET_NAME,
            STORAGE_UNIT_STATUS);
    // Try to execute a before step for the retry storage policy transition when storage unit is not in ARCHIVING state.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper
            .retryStoragePolicyTransition(businessObjectDataKey, new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("Business object data is not currently being archived. " +
            "Storage unit in \"%s\" storage must have \"%s\" status, but it actually has \"%s\" status. Business object data: {%s}", STORAGE_NAME,
            StorageUnitStatusEntity.ARCHIVING, STORAGE_UNIT_STATUS,
            businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataKeyAsString(businessObjectDataKey)), e.getMessage());
    }
}