@Test
public void testDeleteDocument()
{

    Document documentA = new Document();
    Document documentB = new Document();
    documentA.setName( "A" );
    documentB.setName( "B" );
    documentA.setUrl( "UrlA.com" );
    documentB.setUrl( "UrlB.com" );
    documentService.saveDocument( documentA );
    documentService.saveDocument( documentB );
    dashboardItem.getResources().add ( documentA );
    dashboardItem.getResources().add ( documentA ); // Test removing duplicates
    dashboardItem.getResources().add ( documentB );
    dashboardService.saveDashboard( dashboard );
    assertEquals(1, dashboardService.getDocumentDashboardItems( documentA ).size() );
    assertEquals(1, dashboardService.getDocumentDashboardItems( documentB ).size() );
    assertEquals( 1, dashboard.getItemCount() );
    documentService.deleteDocument( documentA );
    assertEquals(0, dashboardService.getDocumentDashboardItems( documentA ).size() );
    assertEquals(1, dashboardService.getDocumentDashboardItems( documentB ).size() );
    assertEquals( 1, dashboard.getItemCount() );
    documentService.deleteDocument( documentB );
    assertEquals(0, dashboardService.getDocumentDashboardItems( documentA ).size() );
    assertEquals(0, dashboardService.getDocumentDashboardItems( documentB ).size() );
    assertEquals( 0, dashboard.getItemCount() );
}