▲ BoardMapperTests.java
페이지 정보

본문
package com.pkt.controller;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.pkt.mapper.BoardMapper;
import com.pkt.model.BoardVO;
import lombok.Setter;
import lombok.extern.log4j.Log4j;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/root-context.xml" })
@Log4j
public class BoardMapperTests {
@Setter(onMethod_ = @Autowired)
private BoardMapper mapper;
//@Test //목록
public void testGetList() {
mapper.getList().forEach(board -> log.info(board));
}
//@Test //글쓰기
public void testCreate() {
BoardVO board = new BoardVO();
board.setTitle("새로운 글 제목");
board.setContent("내용이다.");
board.setWriter("1111");
mapper.create(board);
}
//@Test //읽기
public void testRead() {
log.info(mapper.read(2));
}
//@Test //수정
public void testUpdate() {
BoardVO board = new BoardVO();
board.setBno(2);
board.setTitle("수정된 글이다.");
board.setContent("수정된 내용이다.");
mapper.update(board);
}
//@Test //삭제
public void testDelete() {
mapper.delete(19);
}
}
- 이전글BoardMapper.xml 24.07.30
- 다음글● ② 모델 및 mapper ( xml ) 구현 24.07.30
댓글목록
등록된 댓글이 없습니다.