@Test
public void testValidateAccessStorageHasNoBucketNameAttribute() throws Exception
{

    // Create business object data with storage without bucket name attribute.
    BusinessObjectData businessObjectData = createBusinessObjectData();
    businessObjectData.getStorageUnits().get(0).getStorage().setAttributes(Lists.newArrayList(new Attribute()));
    // Mock the external calls.
    when(propertiesHelper.getProperty(HERD_BASE_URL_PROPERTY)).thenReturn(HERD_BASE_URL);
    when(propertiesHelper.getProperty(HERD_USERNAME_PROPERTY)).thenReturn(HERD_USERNAME);
    when(propertiesHelper.getProperty(HERD_PASSWORD_PROPERTY)).thenReturn(HERD_PASSWORD);
    when(propertiesHelper.getProperty(AWS_REGION_PROPERTY)).thenReturn(AWS_REGION_NAME_US_EAST_1);
    when(propertiesHelper.getProperty(AWS_ROLE_ARN_PROPERTY)).thenReturn(AWS_ROLE_ARN);
    when(propertiesHelper.getProperty(BUSINESS_OBJECT_FORMAT_VERSION_PROPERTY)).thenReturn(BUSINESS_OBJECT_FORMAT_VERSION.toString());
    when(propertiesHelper.getProperty(BUSINESS_OBJECT_DATA_VERSION_PROPERTY)).thenReturn(BUSINESS_OBJECT_DATA_VERSION.toString());
    when(propertiesHelper.getProperty(NAMESPACE_PROPERTY)).thenReturn(NAMESPACE);
    when(propertiesHelper.getProperty(BUSINESS_OBJECT_DEFINITION_NAME_PROPERTY)).thenReturn(BUSINESS_OBJECT_DEFINITION_NAME);
    when(propertiesHelper.getProperty(BUSINESS_OBJECT_FORMAT_USAGE_PROPERTY)).thenReturn(BUSINESS_OBJECT_FORMAT_USAGE);
    when(propertiesHelper.getProperty(BUSINESS_OBJECT_FORMAT_FILE_TYPE_PROPERTY)).thenReturn(BUSINESS_OBJECT_FORMAT_FILE_TYPE);
    when(propertiesHelper.getProperty(PRIMARY_PARTITION_VALUE_PROPERTY)).thenReturn(PRIMARY_PARTITION_VALUE);
    when(propertiesHelper.getProperty(SUB_PARTITION_VALUES_PROPERTY)).thenReturn(SUB_PARTITION_VALUES);
    when(herdApiClientOperations
        .businessObjectDataGetBusinessObjectData(any(BusinessObjectDataApi.class), eq(NAMESPACE), eq(BUSINESS_OBJECT_DEFINITION_NAME),
            eq(BUSINESS_OBJECT_FORMAT_USAGE), eq(BUSINESS_OBJECT_FORMAT_FILE_TYPE), eq(null), eq(PRIMARY_PARTITION_VALUE), eq(SUB_PARTITION_VALUES),
            eq(BUSINESS_OBJECT_FORMAT_VERSION), eq(BUSINESS_OBJECT_DATA_VERSION), eq(null), eq(false), eq(false), eq(false))).thenReturn(businessObjectData);
    // Try to call the method under test.
    try
    {
        accessValidatorController.validateAccess(new File(PROPERTIES_FILE_PATH), false);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals("S3 bucket name is not configured for the storage.", e.getMessage());
    }
    // Verify the external calls.
    verify(herdApiClientOperations).checkPropertiesFile(propertiesHelper, false);
    verify(propertiesHelper).loadProperties(new File(PROPERTIES_FILE_PATH));
    verify(propertiesHelper).getProperty(HERD_BASE_URL_PROPERTY);
    verify(propertiesHelper).getProperty(HERD_USERNAME_PROPERTY);
    verify(propertiesHelper).getProperty(HERD_PASSWORD_PROPERTY);
    verify(herdApiClientOperations).applicationGetBuildInfo(any(ApplicationApi.class));
    verify(herdApiClientOperations).currentUserGetCurrentUser(any(CurrentUserApi.class));
    verify(propertiesHelper).getProperty(AWS_REGION_PROPERTY);
    verify(propertiesHelper).getProperty(AWS_ROLE_ARN_PROPERTY);
    verify(propertiesHelper).getProperty(BUSINESS_OBJECT_FORMAT_VERSION_PROPERTY);
    verify(propertiesHelper).getProperty(BUSINESS_OBJECT_DATA_VERSION_PROPERTY);
    verify(propertiesHelper).getProperty(NAMESPACE_PROPERTY);
    verify(propertiesHelper).getProperty(BUSINESS_OBJECT_DEFINITION_NAME_PROPERTY);
    verify(propertiesHelper).getProperty(BUSINESS_OBJECT_FORMAT_USAGE_PROPERTY);
    verify(propertiesHelper).getProperty(BUSINESS_OBJECT_FORMAT_FILE_TYPE_PROPERTY);
    verify(propertiesHelper).getProperty(PRIMARY_PARTITION_VALUE_PROPERTY);
    verify(propertiesHelper).getProperty(SUB_PARTITION_VALUES_PROPERTY);
    verify(herdApiClientOperations)
        .businessObjectDataGetBusinessObjectData(any(BusinessObjectDataApi.class), eq(NAMESPACE), eq(BUSINESS_OBJECT_DEFINITION_NAME),
            eq(BUSINESS_OBJECT_FORMAT_USAGE), eq(BUSINESS_OBJECT_FORMAT_FILE_TYPE), eq(null), eq(PRIMARY_PARTITION_VALUE), eq(SUB_PARTITION_VALUES),
            eq(BUSINESS_OBJECT_FORMAT_VERSION), eq(BUSINESS_OBJECT_DATA_VERSION), eq(null), eq(false), eq(false), eq(false));
    verifyNoMoreInteractionsHelper();
}