### Question:
DefaultModelBridge implements ModelBridge { @Override public boolean delete(DocumentReference reference) { return delete(reference, false); }  @Override boolean create(DocumentReference documentReference); @Override boolean copy(DocumentReference source, DocumentReference destination); @Override boolean delete(DocumentReference reference); @Override boolean delete(DocumentReference reference, boolean skipRecycleBin); @Override boolean removeLock(DocumentReference reference); @Override void createRedirect(DocumentReference oldReference, DocumentReference newReference); @Override boolean canOverwriteSilently(DocumentReference documentReference); @Override boolean exists(DocumentReference reference); @Override List<DocumentReference> getBackLinkedReferences(DocumentReference documentReference, String wikiId); @Override List<DocumentReference> getDocumentReferences(SpaceReference spaceReference); @Override boolean updateParentField(final DocumentReference oldParentReference,
        final DocumentReference newParentReference); @Override DocumentReference setContextUserReference(DocumentReference userReference); @Override void update(DocumentReference documentReference, Map<String, String> parameters); @Override boolean restoreDeletedDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override List<Long> getDeletedDocumentIds(String batchId); @Override boolean permanentlyDeleteDocument(long deletedDocumentId, AbstractCheckRightsRequest request); @Override boolean permanentlyDeleteAllDocuments(PermanentlyDeleteJob deleteJob, AbstractCheckRightsRequest request); @Override boolean rename(DocumentReference source, DocumentReference destination);  }### Answer:
@Test void deleteTranslation() throws Exception { XWikiDocument sourceDocument = mock(XWikiDocument.class); DocumentReference sourceReference = new DocumentReference("wiki", "Space", "Page", Locale.FRENCH); when(this.xcontext.getWiki().getDocument(sourceReference, this.xcontext)).thenReturn(sourceDocument); when(sourceDocument.getTranslation()).thenReturn(1); this.modelBridge.delete(sourceReference); verify(this.xcontext.getWiki()).deleteDocument(sourceDocument, true, this.xcontext); assertLog(Level.INFO, "Document [{}] has been deleted (to the recycle bin: [{}]).", sourceReference, true); }
@Test void deleteAndSkipTheRecycleBin() throws Exception { XWikiDocument sourceDocument = mock(XWikiDocument.class); DocumentReference sourceReference = new DocumentReference("wiki", "Space", "Page", Locale.FRENCH); when(this.xcontext.getWiki().getDocument(sourceReference, this.xcontext)).thenReturn(sourceDocument); when(sourceDocument.getTranslation()).thenReturn(1); this.modelBridge.delete(sourceReference, true); verify(this.xcontext.getWiki()).deleteDocument(sourceDocument, false, this.xcontext); assertLog(Level.INFO, "Document [{}] has been deleted (to the recycle bin: [{}]).", sourceReference, false); }
@Test void deleteAndThrowException() throws Exception { XWikiDocument sourceDocument = mock(XWikiDocument.class); DocumentReference sourceReference = new DocumentReference("wiki", "Space", "Page", Locale.FRENCH); when(this.xcontext.getWiki().getDocument(sourceReference, this.xcontext)).thenThrow(new XWikiException()); when(sourceDocument.getTranslation()).thenReturn(1); boolean actual = this.modelBridge.delete(sourceReference, false); assertFalse(actual); assertLog(Level.ERROR, "Failed to delete document [{}] (to the recycle bin: [{}]).", sourceReference, true); }
@Test void deleteAllTranslations() throws Exception { DocumentReference sourceReference = new DocumentReference("wiki", "Space", "Page"); XWikiDocument sourceDocument = mock(XWikiDocument.class); when(this.xcontext.getWiki().getDocument(sourceReference, this.xcontext)).thenReturn(sourceDocument); when(sourceDocument.getTranslation()).thenReturn(0); this.modelBridge.delete(sourceReference); verify(this.xcontext.getWiki()).deleteAllDocuments(sourceDocument, true, this.xcontext); assertLog(Level.INFO, "Document [{}] has been deleted with all its translations (to the recycle bin: [{}]).", sourceReference, true); }