### Question:
HibernateDocumentLinkDAO extends HibernatePersistentObjectDAO<DocumentLink> implements DocumentLinkDAO { @Override public boolean delete(long id, int code) { if (!checkStoringAspect()) return false; DocumentLink link = findById(id); if (link != null) { long docId1 = link.getDocument1() != null ? link.getDocument1().getId() : 0; long docId2 = link.getDocument2() != null ? link.getDocument2().getId() : 0; getCurrentSession().delete(link); flush(); updateLinksCount(docId1); updateLinksCount(docId2); } return true; } HibernateDocumentLinkDAO(); @Override List<DocumentLink> findByDocId(long docId); @Override List<DocumentLink> findByDocId(long docId, String type); @Override DocumentLink findByDocIdsAndType(long docId1, long docId2, String type); @Override boolean delete(long id, int code); @Override boolean store(DocumentLink entity);  }### Answer:
@Test public void testDelete() throws PersistenceException { DocumentLink link = dao.findById(1); Assert.assertNotNull(link); Assert.assertTrue(dao.delete(1)); link = dao.findById(1); Assert.assertNull(link); dao.delete(99); link = dao.findById(1); Assert.assertNull(link); link = dao.findById(2); Assert.assertNotNull(link); }