▲ BoardMapperTests.java > SPRING1

본문 바로가기

사이트 내 전체검색

뒤로가기 SPRING1

▲ BoardMapperTests.java

페이지 정보

작성자 관리자 작성일 24-07-30 10:38 조회 674 댓글 0

본문

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);

}

}

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기