@Test public void deleteReturnsFalseOnException() throws XWikiException { Mockito.doThrow(new XWikiException()).when(this.xwiki).deleteDocument(this.doc, this.xcontext); Assert.assertFalse(this.manager.delete(new Person(this.doc))); }
@Override public boolean delete(E entity) { try { XWikiContext xcontext = this.xcontextProvider.get(); XWikiDocument doc = entity.getXDocument(); xcontext.getWiki().deleteDocument(doc, xcontext); return true; } catch (Exception ex) { this.logger.warn("Failed to delete entity [{}]: {}", entity.getDocumentReference(), ex.getMessage()); } return false; }
AbstractPrimaryEntityManager implements PrimaryEntityManager<E> { @Override public boolean delete(E entity) { try { XWikiContext xcontext = this.xcontextProvider.get(); XWikiDocument doc = entity.getXDocument(); xcontext.getWiki().deleteDocument(doc, xcontext); return true; } catch (Exception ex) { this.logger.warn("Failed to delete entity [{}]: {}", entity.getDocumentReference(), ex.getMessage()); } return false; } }
AbstractPrimaryEntityManager implements PrimaryEntityManager<E> { @Override public boolean delete(E entity) { try { XWikiContext xcontext = this.xcontextProvider.get(); XWikiDocument doc = entity.getXDocument(); xcontext.getWiki().deleteDocument(doc, xcontext); return true; } catch (Exception ex) { this.logger.warn("Failed to delete entity [{}]: {}", entity.getDocumentReference(), ex.getMessage()); } return false; }  }
AbstractPrimaryEntityManager implements PrimaryEntityManager<E> { @Override public boolean delete(E entity) { try { XWikiContext xcontext = this.xcontextProvider.get(); XWikiDocument doc = entity.getXDocument(); xcontext.getWiki().deleteDocument(doc, xcontext); return true; } catch (Exception ex) { this.logger.warn("Failed to delete entity [{}]: {}", entity.getDocumentReference(), ex.getMessage()); } return false; }  @Override E create(); @Override synchronized E create(DocumentReference creator); @Override E get(String id); @Override E get(DocumentReference reference); @Override E getByName(String name); @Override Iterator<E> getAll(); @Override boolean delete(E entity); @Override E load(DocumentModelBridge document); @Override String getIdPrefix(); @Override EntityReference getEntityType(); }
AbstractPrimaryEntityManager implements PrimaryEntityManager<E> { @Override public boolean delete(E entity) { try { XWikiContext xcontext = this.xcontextProvider.get(); XWikiDocument doc = entity.getXDocument(); xcontext.getWiki().deleteDocument(doc, xcontext); return true; } catch (Exception ex) { this.logger.warn("Failed to delete entity [{}]: {}", entity.getDocumentReference(), ex.getMessage()); } return false; }  @Override E create(); @Override synchronized E create(DocumentReference creator); @Override E get(String id); @Override E get(DocumentReference reference); @Override E getByName(String name); @Override Iterator<E> getAll(); @Override boolean delete(E entity); @Override E load(DocumentModelBridge document); @Override String getIdPrefix(); @Override EntityReference getEntityType();  }