UserTest.java
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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");
}
}