()
| 23 | BoardDao boardDao; |
| 24 | |
| 25 | @Test |
| 26 | public void remove() throws Exception { |
| 27 | boardDao.deleteAll(); |
| 28 | |
| 29 | BoardDto boardDto = new BoardDto("hello", "hello", "asdf"); |
| 30 | assertTrue(boardDao.insert(boardDto) == 1); |
| 31 | Integer bno = boardDao.selectAll().get(0).getBno(); |
| 32 | System.out.println("bno = " + bno); |
| 33 | |
| 34 | commentDao.deleteAll(bno); |
| 35 | CommentDto commentDto = new CommentDto(bno,0,"hi","qwer"); |
| 36 | |
| 37 | assertTrue(boardDao.select(bno).getComment_cnt() == 0); |
| 38 | assertTrue(commentService.write(commentDto)==1); |
| 39 | assertTrue(boardDao.select(bno).getComment_cnt() == 1); |
| 40 | |
| 41 | Integer cno = commentDao.selectAll(bno).get(0).getCno(); |
| 42 | |
| 43 | // 일부러 예외를 발생시키고 Tx가 취소되는지 확인해야. |
| 44 | int rowCnt = commentService.remove(cno, bno, commentDto.getCommenter()); |
| 45 | assertTrue(rowCnt==1); |
| 46 | assertTrue(boardDao.select(bno).getComment_cnt() == 0); |
| 47 | } |
| 48 | |
| 49 | @Test |
| 50 | public void write() throws Exception { |
nothing calls this directly
no test coverage detected