forked from kongzf/ssm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserServerTest.java
More file actions
53 lines (46 loc) · 1.48 KB
/
UserServerTest.java
File metadata and controls
53 lines (46 loc) · 1.48 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
package serviceTest;
import java.util.List;
import org.apache.ibatis.session.RowBounds;
import org.aspectj.weaver.NewConstructorTypeMunger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import core.common.PageInfo;
import base.BaseControllerTest;
import blog.dao.User;
import blog.service.imp.UserService;
/**
*
* create by Liujishuai on 2015年9月21日
*/
public class UserServerTest extends BaseControllerTest {
@Autowired
private UserService userService;
@Test
public void testInsertUser(){
User user=new User();
user.setName("张磊");
user.setPassword("123123");
user.setLevel(1);
user.setDes("中国好声音第四季张磊");
user.setAddress("浙江杭州");
userService.insert(user);
}
@Test
public void testGetUserById(){
Integer id=1;
User user=userService.selectByPrimaryKey(id);
System.out.println(user.getName()+":"+user.getDes());
}
@Test
public void testGetUserList(){
String username="sk";
List<User> pageInfo= userService.getUserList(null, username, new RowBounds(1,2));
String objString=new Gson().toJson(pageInfo);
System.out.println(objString);
}
}