DashboardItemDeletionHandler extends DeletionHandler { @Override public void deleteMap( Map map ) { for ( DashboardItem item : dashboardService.getMapDashboardItems( map ) ) { dashboardService.deleteDashboardItem( item ); } } DashboardItemDeletionHandler( DashboardService dashboardService ); @Override void deleteVisualization( Visualization visualization ); @Override void deleteReportTable( ReportTable reportTable ); @Override void deleteChart( Chart chart ); @Override void deleteEventChart( EventChart eventChart ); @Override void deleteMap( Map map ); @Override void deleteEventReport( EventReport eventReport ); @Override void deleteUser( User user ); @Override void deleteReport( Report report ); @Override void deleteDocument( Document document );  }
@Test public void testDeleteMap() { Map map = new Map(); map.setName( "A" ); mappingService.addMap( map ); dashboardItem.setMap( map ); dashboardService.saveDashboard( dashboard ); assertEquals(1, dashboardService.getMapDashboardItems( map ).size() ); assertEquals( 1, dashboard.getItemCount() ); mappingService.deleteMap( map ); assertEquals(0, dashboardService.getMapDashboardItems( map ).size() ); assertEquals( 0, dashboard.getItemCount() ); }