@Test
public void testGetStorageFileEntityByStorageUnitEntityAndFilePathWithNullStorageFileEntityWithBlankDirectoryPath()
{

    // Create a new business object data key
    BusinessObjectDataKey businessObjectDataKey =
        new BusinessObjectDataKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES,
            DATA_VERSION);
    // Create a storage unit entity.
    StorageEntity storageEntity = new StorageEntity();
    storageEntity.setName(STORAGE_NAME);
    StorageUnitEntity storageUnitEntity = new StorageUnitEntity();
    storageUnitEntity.setStorage(storageEntity);
    // Create a file path.
    String filePath = TEST_S3_KEY_PREFIX + "/" + LOCAL_FILE;
    // Mock the external calls.
    when(storageFileDao.getStorageFileByStorageUnitEntityAndFilePath(storageUnitEntity, filePath)).thenReturn(null);
    try
    {
        // Call the method under test.
        storageFileDaoHelper.getStorageFileEntity(storageUnitEntity, filePath, businessObjectDataKey);
        fail();
    }
    catch (ObjectNotFoundException objectNotFoundException)
    {
        // Validate the exception message.
        assertThat("Exception message not equal to expected exception message.", objectNotFoundException.getMessage(), is(String
            .format("Storage file \"%s\" doesn't exist in \"%s\" storage. Business object data: {%s}", filePath, storageUnitEntity.getStorage().getName(),
                businessObjectDataHelper.businessObjectDataKeyToString(businessObjectDataKey))));
    }
    // Verify the external calls.
    verify(storageFileDao).getStorageFileByStorageUnitEntityAndFilePath(storageUnitEntity, filePath);
    verify(businessObjectDataHelper, times(2)).businessObjectDataKeyToString(businessObjectDataKey);
    verifyNoMoreInteractionsHelper();
}