VehicleDeviceServiceTest.java
1.53 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
42
43
44
45
46
47
48
49
50
51
52
53
54
package cn.com.glsx.admin.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.auth.model.Department;
import cn.com.glsx.auth.model.Role;
import cn.com.glsx.auth.model.SyntheticUser;
import cn.com.glsx.auth.utils.ShieldContextHolder;
import lombok.extern.slf4j.Slf4j;
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.ArrayList;
import java.util.List;
/**
* @Desc:
* @Author huangxc
* @Date 2021/5/27
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class VehicleDeviceServiceTest {
@Autowired
private VehicleDeviceService VehicleDeviceService;
@Before
public void runBeforeTestMethod() {
SyntheticUser user = new SyntheticUser();
user.setUserId(6551L);
user.setIsSupperAdmin(false);
user.setAccount("DGD101");
Department department = new Department();
department.setDeptId(182L);
user.setDepartment(department);
List<Role> roleList=new ArrayList<>();
Role role=new Role();
role.setRoleId(38L);
roleList.add(role);
user.setRoles(roleList);
ShieldContextHolder.setUser(user);
}
@Test
public void testUnBindBySn() {
VehicleDeviceService.unBindBySn("8700922797");
}
}