▲ BoardMapperTests.java
페이지 정보
본문
package com.pkt.controller;
import java.util.List;
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 org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import com.pkt.mapper.BoardMapper;
import com.pkt.model.BoardVO;
import com.pkt.model.Criteria;
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 // 추가 테스트 ( JUnit Test )
public void testDynamic1() throws Exception {
Criteria cri = new Criteria();
cri.setKeyword("테스트");
cri.setSearchType("t"); //제목(title)
log.info("-------------------------------------");
log.info(cri.toString());
List<BoardVO> list = mapper.listSearch(cri);
for (BoardVO boardVO : list) {
log.info(boardVO.getBno() + ": " + boardVO.getTitle()); //목록 출력
}
log.info("=====================================");
log.info("COUNT: " + mapper.listSearchCount(cri)); //검색된 총 개수
}
}
- 이전글BoardMapper.xml 24.07.30
- 다음글● 검색 처리 1 ( 설명 참고 ) 24.07.30
댓글목록
등록된 댓글이 없습니다.