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

    Item item = newItem();
    String doi1 = this.createDOI(item, DOIIdentifierProvider.IS_REGISTERED, true);
    String doi2 = this.createDOI(item, DOIIdentifierProvider.IS_REGISTERED, true);
    
    // remove one of it
    context.turnOffAuthorisationSystem();
    provider.delete(context, item);
    context.restoreAuthSystemState();
    // assure that the right one was removed
    List<MetadataValue> metadata = itemService.getMetadata(item, DOIIdentifierProvider.MD_SCHEMA,
            DOIIdentifierProvider.DOI_ELEMENT,
            DOIIdentifierProvider.DOI_QUALIFIER,
            null);
    boolean foundDOI1 = false;
    boolean foundDOI2 = false;
    for (MetadataValue id : metadata)
    {
        if (id.getValue().equals(doiService.DOIToExternalForm(doi1)))
        {
            foundDOI1 = true;
        }
        if (id.getValue().equals(doiService.DOIToExternalForm(doi2)))
        {
            foundDOI2 = true;
        }
    }
    assertFalse("Cannot remove DOI from item metadata.", foundDOI1);
    assertFalse("Did not removed all DOIs from item metadata.", foundDOI2);
    
    DOI doiRow1 = doiService.findByDoi(context, doi1.substring(DOI.SCHEME.length()));
    assumeNotNull(doiRow1);
    assertTrue("Status of deleted DOI was not set correctly.",
            DOIIdentifierProvider.TO_BE_DELETED.equals(doiRow1.getStatus()));
    DOI doiRow2 = doiService.findByDoi(context, doi1.substring(DOI.SCHEME.length()));
    assumeNotNull(doiRow2);
    assertTrue("Did not set the status of all deleted DOIs as expected.",
            DOIIdentifierProvider.TO_BE_DELETED.equals(doiRow2.getStatus()));
}