현재 버전

@kenu



public class BoardDAOTest {
	SqlSession session;
	BoardService boardService;
	BoardVO vo;
	GenericXmlApplicationContext ctx;
	private static final Logger logger = LoggerFactory.getLogger(BoardDAOTest.class);

	@Before
	public void setup() throws Exception {
		session = MybatisSqlSessionFactory.openSession();
		logger.debug("세션을 성공적으로 불러왔습니다.");
		logger.debug("DAO 객체 생성완료");
		ctx = new GenericXmlApplicationContext("classpath:/applicationContext.xml");
		boardService = (BoardService) ctx.getBean("boardService");
		vo = new BoardVO();
		vo.setId(7);
		vo.setName("윤도담");
		vo.setSubject("안녕");
		vo.setContent("반가워요22");
		vo.setRegDate("2017-10-2-2");
		vo.setCount(4);
		vo.setPassword("1234");
		logger.debug("테스트 객체 생성완료");
	}
	
	@AfterClass
	public void end() {
		ctx.close();
	}

	@Test
	public void createBoardTest() {
		boardService.createBoard(vo);
	}
	
	@Test
	public void getBoardTest() throws Exception {
		BoardVO board = boardService.getBoard(vo.getId());
		assertNotNull(board);
		logger.debug(board.toString());
	}
	
	@Test
	public void getBoardListTest() throws Exception {
		List<BoardVO> list = boardService.getBoardList();
		assertNotNull(list);
		for (BoardVO board : list) {
			logger.debug(board.toString());
		}
	}
	
	@Test
	public void modifyBoardTest() throws Exception {
		BoardVO up = new BoardVO();
		up.setId(7);
		up.setSubject("나가");
		up.setContent("22324");
		boardService.modifyBoard(up);
	}
	@Test
	public void deleteBoardTest() throws Exception {
		boardService.deleteBoard(vo.getId());
		assertNull(boardService.getBoard(vo.getId()));
	}
}


네 코드는 위와 같아요


수정 이력

2017-08-22 12:09:39 에 아래 내용에서 변경 됨 #1




public class BoardDAOTest {
	SqlSession session;
	BoardService boardService;
	BoardVO vo;
	GenericXmlApplicationContext ctx;
	private static final Logger logger = LoggerFactory.getLogger(BoardDAOTest.class);

	@Before
	public void setup() throws Exception {
		session = MybatisSqlSessionFactory.openSession();
		logger.debug("세션을 성공적으로 불러왔습니다.");
		logger.debug("DAO 객체 생성완료");
		ctx = new GenericXmlApplicationContext("classpath:/applicationContext.xml");
		boardService = (BoardService) ctx.getBean("boardService");
		vo = new BoardVO();
		vo.setId(7);
		vo.setName("윤도담");
		vo.setSubject("안녕");
		vo.setContent("반가워요22");
		vo.setRegDate("2017-10-2-2");
		vo.setCount(4);
		vo.setPassword("1234");
		logger.debug("테스트 객체 생성완료");
	}
	
	@AfterClass
	public void end() {
		ctx.close();
	}

	@Test
	public void createBoardTest() {
		boardService.createBoard(vo);
	}
	
	@Test
	public void getBoardTest() throws Exception {
		BoardVO board = boardService.getBoard(vo.getId());
		assertNotNull(board);
		logger.debug(board.toString());
	}
	
	@Test
	public void getBoardListTest() throws Exception {
		List<BoardVO> list = boardService.getBoardList();
		assertNotNull(list);
		for (BoardVO board : list) {
			logger.debug(board.toString());
		}
	}
	
	@Test
	public void modifyBoardTest() throws Exception {
		BoardVO up = new BoardVO();
		up.setId(7);
		up.setSubject("나가");
		up.setContent("22324");
		boardService.modifyBoard(up);
	}
	@Test
	public void deleteBoardTest() throws Exception {
		boardService.deleteBoard(vo.getId());
		assertNull(boardService.getBoard(vo.getId()));
	}
}


네 코드는 위와 같아요