@Test public void shouldDeleteContentArticleAndContentArticleVersions() throws Exception { Long contentArticleId = 2L; int totalOfContentArticleVersions = contentArticleVersionDao.findByGiven(new PaginationHelper(0,10,null),contentArticleId,null,null,null,null,null).size(); int ret = contentArticleService.delete(contentArticleId); assertTrue(ret > 0); int totalAfterDelete = contentArticleVersionDao.findByGiven(new PaginationHelper(0,10,null),2L,null,null,null,null,null).size(); assertEquals(totalAfterDelete,0); assertNotEquals(totalOfContentArticleVersions,totalAfterDelete); exception.expect(NotFoundException.class); contentArticleDao.get(contentArticleId); }
public int delete(long contentArticleId) { final int articlesDeleted = contentArticleDao.delete(contentArticleId); final int versionsDeleted = contentArticleVersionDao.deleteByArticleId(contentArticleId); return articlesDeleted + versionsDeleted; }
ContentArticleService { public int delete(long contentArticleId) { final int articlesDeleted = contentArticleDao.delete(contentArticleId); final int versionsDeleted = contentArticleVersionDao.deleteByArticleId(contentArticleId); return articlesDeleted + versionsDeleted; } }
ContentArticleService { public int delete(long contentArticleId) { final int articlesDeleted = contentArticleDao.delete(contentArticleId); final int versionsDeleted = contentArticleVersionDao.deleteByArticleId(contentArticleId); return articlesDeleted + versionsDeleted; } @Autowired  ContentArticleService(ContentArticleDao contentArticleDao,
            ContentArticleVersionDao contentArticleVersionDao); }
ContentArticleService { public int delete(long contentArticleId) { final int articlesDeleted = contentArticleDao.delete(contentArticleId); final int versionsDeleted = contentArticleVersionDao.deleteByArticleId(contentArticleId); return articlesDeleted + versionsDeleted; } @Autowired  ContentArticleService(ContentArticleDao contentArticleDao,
            ContentArticleVersionDao contentArticleVersionDao); int delete(long contentArticleId); }
ContentArticleService { public int delete(long contentArticleId) { final int articlesDeleted = contentArticleDao.delete(contentArticleId); final int versionsDeleted = contentArticleVersionDao.deleteByArticleId(contentArticleId); return articlesDeleted + versionsDeleted; } @Autowired  ContentArticleService(ContentArticleDao contentArticleDao,
            ContentArticleVersionDao contentArticleVersionDao); int delete(long contentArticleId);  }