@Test
public void testRetryStoragePolicyTransitionInvalidParameters()
{

    // 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);
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForRetryStoragePolicyTransitionTesting(businessObjectDataKey, storagePolicyKey);
    // Validate existence of business object data and storage policy.
    assertNotNull(businessObjectDataDao.getBusinessObjectDataByAltKey(businessObjectDataKey));
    assertNotNull(storagePolicyDao.getStoragePolicyByAltKey(storagePolicyKey));
    // Try to execute a before step for the retry storage policy transition using an invalid namespace.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(I_DO_NOT_EXIST, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(I_DO_NOT_EXIST, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid business object definition name.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, I_DO_NOT_EXIST, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, I_DO_NOT_EXIST, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid format usage.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, I_DO_NOT_EXIST, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, I_DO_NOT_EXIST, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid format file type.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, I_DO_NOT_EXIST, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES,
                DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, I_DO_NOT_EXIST, FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid business object format version.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INVALID_FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INVALID_FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid primary partition value.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, I_DO_NOT_EXIST,
                SUBPARTITION_VALUES, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                I_DO_NOT_EXIST, SUBPARTITION_VALUES, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid sub-partition value.
    for (int i = 0; i < SUBPARTITION_VALUES.size(); i++)
    {
        List<String> testSubPartitionValues = new ArrayList<>(SUBPARTITION_VALUES);
        testSubPartitionValues.set(i, I_DO_NOT_EXIST);
        try
        {
            businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
                new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                    testSubPartitionValues, DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
            fail();
        }
        catch (ObjectNotFoundException e)
        {
            assertEquals(businessObjectDataServiceTestHelper
                .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                    PARTITION_VALUE, testSubPartitionValues, DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
        }
    }
    // Try to execute a before step for the retry storage policy transition using an invalid business object data version.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(
            new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
                SUBPARTITION_VALUES, INVALID_DATA_VERSION), new BusinessObjectDataRetryStoragePolicyTransitionRequest(storagePolicyKey));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(businessObjectDataServiceTestHelper
            .getExpectedBusinessObjectDataNotFoundErrorMessage(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION,
                PARTITION_VALUE, SUBPARTITION_VALUES, INVALID_DATA_VERSION, NO_BDATA_STATUS), e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid storage policy namespace.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(businessObjectDataKey,
            new BusinessObjectDataRetryStoragePolicyTransitionRequest(new StoragePolicyKey(I_DO_NOT_EXIST, STORAGE_POLICY_NAME)));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(storagePolicyServiceTestHelper.getExpectedStoragePolicyNotFoundErrorMessage(new StoragePolicyKey(I_DO_NOT_EXIST, STORAGE_POLICY_NAME)),
            e.getMessage());
    }
    // Try to execute a before step for the retry storage policy transition using an invalid storage policy name.
    try
    {
        businessObjectDataRetryStoragePolicyTransitionHelper.retryStoragePolicyTransition(businessObjectDataKey,
            new BusinessObjectDataRetryStoragePolicyTransitionRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, I_DO_NOT_EXIST)));
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(
            storagePolicyServiceTestHelper.getExpectedStoragePolicyNotFoundErrorMessage(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, I_DO_NOT_EXIST)),
            e.getMessage());
    }
}