@Test
public void testGetStorageUnitEntityByKeyStorageUnitNoExists()
{

    // Create a storage unit key.
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey =
        new BusinessObjectDataStorageUnitKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            SUBPARTITION_VALUES, DATA_VERSION, STORAGE_NAME);
    // Mock the external calls.
    when(storageUnitDao.getStorageUnitByKey(businessObjectDataStorageUnitKey)).thenReturn(null);
    // Try to call the method under test.
    try
    {
        storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
        fail();
    }
    catch (ObjectNotFoundException e)
    {
        assertEquals(String.format(
            "Business object data storage unit {namespace: \"%s\", businessObjectDefinitionName: \"%s\", businessObjectFormatUsage: \"%s\", " +
                "businessObjectFormatFileType: \"%s\", businessObjectFormatVersion: %d, businessObjectDataPartitionValue: \"%s\", " +
                "businessObjectDataSubPartitionValues: \"%s,%s,%s,%s\", businessObjectDataVersion: %d, storageName: \"%s\"} doesn't exist.", BDEF_NAMESPACE,
            BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1),
            SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3), DATA_VERSION, STORAGE_NAME), e.getMessage());
    }
    // Verify the external calls.
    verify(storageUnitDao).getStorageUnitByKey(businessObjectDataStorageUnitKey);
    verifyNoMoreInteractionsHelper();
}