@Test
public void testUpdateBusinessObjectDataAttributesDuplicateAttributes()
{

    // Create two business object data attribute entities that use the same attribute name (case-insensitive).
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntityA = new BusinessObjectDataAttributeEntity();
    businessObjectDataAttributeEntityA.setName(ATTRIBUTE_NAME.toUpperCase());
    businessObjectDataAttributeEntityA.setValue(ATTRIBUTE_VALUE);
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntityB = new BusinessObjectDataAttributeEntity();
    businessObjectDataAttributeEntityB.setName(ATTRIBUTE_NAME.toLowerCase());
    businessObjectDataAttributeEntityB.setValue(ATTRIBUTE_VALUE_2);
    // Create a business object data entity that contains duplicate attributes (case-insensitive).
    BusinessObjectDataEntity businessObjectDataEntity = new BusinessObjectDataEntity();
    List<BusinessObjectDataAttributeEntity> businessObjectDataAttributeEntities = new ArrayList<>();
    businessObjectDataEntity.setAttributes(businessObjectDataAttributeEntities);
    businessObjectDataAttributeEntities.add(businessObjectDataAttributeEntityA);
    businessObjectDataAttributeEntities.add(businessObjectDataAttributeEntityB);
    // Mock the external calls.
    when(businessObjectDataHelper.businessObjectDataEntityAltKeyToString(businessObjectDataEntity)).thenReturn(BUSINESS_OBJECT_DATA_KEY_AS_STRING);
    // Try to call the method under test.
    try
    {
        attributeDaoHelper.updateBusinessObjectDataAttributes(businessObjectDataEntity, NO_ATTRIBUTES);
        fail();
    }
    catch (IllegalStateException e)
    {
        assertEquals(String
            .format("Found duplicate attribute with name \"%s\" for business object data. Business object data: {%s}", ATTRIBUTE_NAME.toLowerCase(),
                BUSINESS_OBJECT_DATA_KEY_AS_STRING), e.getMessage());
    }
    // Verify the external calls.
    verify(businessObjectDataHelper).businessObjectDataEntityAltKeyToString(businessObjectDataEntity);
    verifyNoMoreInteractionsHelper();
}