/**
* @throws NoPermissionException
*/
@Test
public void removeResourceWithDataAccessException() throws NoPermissionException {
Resource resource = getDefaultResource();
policyService.checkPermission(resourceType, PolicyConstants.PERM_DELETE, (SessionInfo) null);
resourceDatabase.removeResource(resource.getResourceId());
expectLastCall().andThrow(new DataAccessException("Failed to remove resource."));
CoreEvent deleteEvent = getDeleteEvent(resourceService.getRemoveEventId(), CoreEvent.STATE_UNSUCCESSFUL);
coreEventService.fireCoreEvent(eqCoreEvent(deleteEvent));
mocksControl.replay();
try {
resourceService.removeResource(resource.getResourceId(), null);
fail("Should have thrown an exception");
} catch (DataAccessException e) {
// nothing to do
}