UserTest.java 1.2 KB
package com.tianbo.warehouse;

import com.github.pagehelper.PageInfo;
import com.tianbo.warehouse.WarehouseApplication;
import com.tianbo.warehouse.model.ROLE;
import com.tianbo.warehouse.security.CustomUserDetailService;
import com.tianbo.warehouse.service.RoleService;
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;
import com.tianbo.warehouse.dao.ROLEMapper;

import javax.annotation.Resource;
import java.util.List;

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

    @Autowired
    CustomUserDetailService customUserDetailService;

    @Resource
    ROLEMapper roleMapper;

    @Autowired
    RoleService roleService;

    @Test
    public void contextLoads() {

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