@Test
public void testRemove_DOI_from_item_metadata()
        throws SQLException, AuthorizeException, IOException, IdentifierException, WorkflowException, IllegalAccessException
{

    Item item = newItem();
    String doi = DOI.SCHEME + PREFIX + "/" + NAMESPACE_SEPARATOR 
            + Long.toHexString(new Date().getTime());
    context.turnOffAuthorisationSystem();
    itemService.addMetadata(context, item, DOIIdentifierProvider.MD_SCHEMA,
            DOIIdentifierProvider.DOI_ELEMENT,
            DOIIdentifierProvider.DOI_QUALIFIER,
            null,
            doiService.DOIToExternalForm(doi));
    itemService.update(context, item);
    
    provider.removeDOIFromObject(context, item, doi);
    context.restoreAuthSystemState();
    
    List<MetadataValue> metadata = itemService.getMetadata(item, DOIIdentifierProvider.MD_SCHEMA,
            DOIIdentifierProvider.DOI_ELEMENT,
            DOIIdentifierProvider.DOI_QUALIFIER,
            null);
    boolean foundDOI = false;
    for (MetadataValue id : metadata)
    {
        if (id.getValue().equals(doiService.DOIToExternalForm(doi)))
        {
            foundDOI = true;
        }
    }
    assertFalse("Cannot remove DOI from item metadata.", foundDOI);
}