@Test
public void onDeleteException() throws Exception {

    final KeyedObject deleteCandidateItem = new KeyedObject();
    final KeyedObject deletedItem = new KeyedObject();
    final Exception e = new Exception();
    final DatabaseOperationMetadata databaseOperationMetadata = new DatabaseOperationMetadata();
    when(mTableActionAlterations.preDelete(deleteCandidateItem)).thenReturn(Single.just(deleteCandidateItem));
    when(mTable.delete(deleteCandidateItem, databaseOperationMetadata)).thenReturn(Single.error(e));
    when(mTableActionAlterations.postDelete(deletedItem)).thenReturn(Single.just(deletedItem));
    mAbstractTableController.unsubscribe(mListener2);
    mAbstractTableController.delete(deleteCandidateItem, databaseOperationMetadata);
    verify(mAnalytics).record(any(ErrorEvent.class));
    verify(mListener1).onDeleteFailure(deleteCandidateItem, e, databaseOperationMetadata);
    verify(mListener3).onDeleteFailure(deleteCandidateItem, e, databaseOperationMetadata);
    verifyZeroInteractions(mListener2);
}