SpringBoot测试Mapper
package com.what21.demo.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.what21.demo.model.Role;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class RoleMapperTest {
@Autowired
private RoleMapper roleMapper;
@Before
public void testBefore(){
System.out.println("testBefore()");
}
@Test
public void testGet() {
QueryWrapper<Role> queryWrapper = new QueryWrapper<Role>();
List<Role> list = roleMapper.selectList(queryWrapper);
System.out.println(list);
}
@After
public void testAfter(){
System.out.println("testAfter()");
}
}