SPRING/chapter04_MVC
ReplyMapperTests.java
GAWON
2023. 7. 18. 09:39
package org.joonzis.mapper;
import java.util.List;
import org.joonzis.domain.ReplyVO;
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 lombok.Setter;
import lombok.extern.log4j.Log4j;
@Log4j
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
public class ReplyMapperTests {
@Setter(onMethod_ = @Autowired)
ReplyMapper mapper;
/*
// 댓글 삽입
@Test
public void testInsert() {
ReplyVO rvo = new ReplyVO();
rvo.setBno(3);
rvo.setReply("테스트03");
rvo.setReplyer("테스트03");
mapper.insert(rvo);
log.info(rvo);
}
*/
/*
// 한 게시물 댓글 조회
@Test
public void testGetList() {
List<ReplyVO> list = mapper.getList(3);
// vo 출력
for(ReplyVO rvo : list) {
log.info(rvo);
}
}
*/
/*
// 댓글 한개 조회
@Test
public void testread() {
ReplyVO rvo = mapper.read(21);
log.info(rvo);
}
*/
/*
// 댓글 삭제
@Test
public void delete() {
int result = mapper.delete(41);
log.info("삭제된 행의 수 : " + result);
}
*/
@Test
public void update() {
ReplyVO rvo = new ReplyVO();
rvo.setReply("테스트 수정");
rvo.setRno(1);
mapper.update(rvo);
log.info(rvo);
}
}