@Test
public void testCreateStoragePolicy()
{

    // Create a storage policy key.
    StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME);
    StoragePolicy storagePolicy = new StoragePolicy(ID, storagePolicyKey, new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE),
        new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME),
        new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED);
    StoragePolicyCreateRequest request = storagePolicyServiceTestHelper
        .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME,
            FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED);
    when(storagePolicyService.createStoragePolicy(request)).thenReturn(storagePolicy);
    // Create a storage policy.
    StoragePolicy resultStoragePolicy = storagePolicyRestController.createStoragePolicy(request);
    // Verify the external calls.
    verify(storagePolicyService).createStoragePolicy(request);
    verifyNoMoreInteractions(storagePolicyService);
    // Validate the returned object.
    assertEquals(storagePolicy, resultStoragePolicy);
}