package kr.co.jinwoosi.clfd.clfd.dgns.mapper;

import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsList;
import kr.co.jinwoosi.clfd.clfd.dgns.model.DgnsListSearch;
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 java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
        "classpath:config/spring/context-datasource.xml",
        "classpath:config/spring/context-mybatis.xml",
        "classpath:config/spring/context-common.xml",
        "classpath:config/spring/context-transaction.xml"
})
public class DgnsListMapperTest {

    @Autowired
    private DgnsListMapper dgnsListMapper;

//    @Test
    public void insertTest() {
        DgnsList dgnsList = new DgnsList();
        dgnsList.setDgnsId(7L);
        dgnsList.setRegId(7L);
        dgnsList.setDgnsAskId(2L);
        dgnsList.setDgnsAnsId(2L);
        dgnsListMapper.insert(dgnsList);
    }

    @Test
    public void selectTest() {
        DgnsListSearch dgnsListSearch = new DgnsListSearch();
        dgnsListSearch.setDgnsListId(1L);
        dgnsListSearch.setRecSt("Y");
        DgnsList dgnsList = dgnsListMapper.select(dgnsListSearch);
        System.out.println(dgnsList.toString());
    }

    @Test
    public void selectListTest() {
        DgnsListSearch dgnsListSearch = new DgnsListSearch();
        dgnsListSearch.setRecSt("Y");
        dgnsListSearch.setDgnsId(7L);
        List<DgnsList> dgnsListList = dgnsListMapper.selectList(dgnsListSearch);
        System.out.println(dgnsListList.size());
    }

    @Test
    public void countTest() {
        DgnsListSearch dgnsListSearch = new DgnsListSearch();
        dgnsListSearch.setRecSt("Y");
        dgnsListSearch.setDgnsId(7L);
        Integer count = dgnsListMapper.count(dgnsListSearch);
        System.out.println(count);
    }
}
