RoleServiceImplTest.java
1.58 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
55
56
57
58
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.service.IRoleService;
import com.genersoft.iot.vmp.service.IUserService;
import com.genersoft.iot.vmp.storager.dao.dto.Role;
import com.genersoft.iot.vmp.storager.dao.dto.User;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
@SpringBootTest
@RunWith(SpringRunner.class)
class RoleServiceImplTest {
@Resource
private IRoleService roleService;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@org.junit.jupiter.api.Test
void getAllUser() {
List<Role> all = roleService.getAll();
Role roleById = roleService.getRoleById(1);
System.out.println();
}
@org.junit.jupiter.api.Test
void add() {
for (int i = 0; i < 10; i++) {
Role role = new Role();
role.setName("test+" + i);
role.setAuthority("adadadda");
role.setCreateTime(format.format(System.currentTimeMillis()));
role.setUpdateTime(format.format(System.currentTimeMillis()));
roleService.add(role);
}
}
@org.junit.jupiter.api.Test
void delete() {
roleService.delete(20);
}
@org.junit.jupiter.api.Test
void update() {
Role role = new Role();
role.setId(21);
role.setName("TTTTTT");
role.setAuthority("adadadda");
roleService.update(role);
}
}