package com.mx.cneeds.server.user.dao;

import com.mx.cneeds.server.dao.SysDeptDao;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;

/**
 * @ClassName SysDeptDaoTest
 * @Author zzrdark
 * @Date 2020-08-04 17:29
 * @Description TODO
 **/
@SpringBootTest
@RunWith(SpringRunner.class)
@MapperScan("com.mx.cneeds.server.dao")
public class SysDeptDaoTest extends TestCase {

    @Autowired
    private SysDeptDao sysDeptDao;

    @Test
    @Sql(scripts = "/sql/create_sys_dept.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
    @Sql(statements = "insert into `sys_dept` values (1,1,'root',0,'123456','dddd')")
    @Sql(statements = "insert into `sys_dept` values (2,1,'root',0,'123456789','aaaa')")
    @Sql(scripts = "/sql/drop_sys_dept.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
    public void testQueryDetpIdList(){
        List<Long> longs = sysDeptDao.queryDetpIdList(1L);
//
        for (long l : longs){
            Assert.assertNotNull(l);
        }
        System.out.println("success");
    }
}
