审查视图

src/test/java/com/tianbo/warehouse/UserTest.java 1.2 KB
1 2
package com.tianbo.warehouse;
3
import com.github.pagehelper.PageInfo;
4
import com.tianbo.warehouse.WarehouseApplication;
5
import com.tianbo.warehouse.model.ROLE;
6
import com.tianbo.warehouse.security.CustomUserDetailService;
7
import com.tianbo.warehouse.service.RoleService;
8 9 10 11 12 13 14
import lombok.extern.slf4j.Slf4j;
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.security.core.userdetails.UserDetails;
import org.springframework.test.context.junit4.SpringRunner;
15 16 17 18
import com.tianbo.warehouse.dao.ROLEMapper;

import javax.annotation.Resource;
import java.util.List;
19 20 21 22 23 24 25 26 27

@RunWith(SpringRunner.class)
@SpringBootTest(classes = WarehouseApplication.class,webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Slf4j
public class UserTest {

    @Autowired
    CustomUserDetailService customUserDetailService;
28 29 30
    @Resource
    ROLEMapper roleMapper;
31 32 33
    @Autowired
    RoleService roleService;
34 35 36 37
    @Test
    public void contextLoads() {

        UserDetails u = customUserDetailService.loadUserByUsername("nmms");
38
        PageInfo<ROLE> all = roleService.findAll(1, 20, "瑞泰", null);
39 40 41
        log.info("ok");
    }
}