分页单元测试
This commit is contained in:
parent
4f09acfdaa
commit
7aa2e990f0
|
@ -1,8 +1,8 @@
|
|||
package com.zheng.upms.rpc.service;
|
||||
|
||||
import com.zheng.upms.dao.mapper.UpmsUserMapper;
|
||||
import com.zheng.upms.dao.model.UpmsSystemExample;
|
||||
import com.zheng.upms.dao.model.UpmsUser;
|
||||
import com.zheng.upms.dao.model.*;
|
||||
import com.zheng.upms.rpc.api.UpmsPermissionService;
|
||||
import com.zheng.upms.rpc.api.UpmsSystemService;
|
||||
import com.zheng.upms.rpc.api.UpmsUserService;
|
||||
import org.junit.Test;
|
||||
|
@ -12,6 +12,8 @@ import org.springframework.test.context.ContextConfiguration;
|
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.transaction.TransactionConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单元测试
|
||||
* Created by shuzheng on 2017/2/19.
|
||||
|
@ -34,6 +36,9 @@ public class UpmsServiceTest {
|
|||
@Autowired
|
||||
private UpmsUserService upmsUserService;
|
||||
|
||||
@Autowired
|
||||
private UpmsPermissionService upmsPermissionService;
|
||||
|
||||
@Test
|
||||
public void index() {
|
||||
UpmsUser upmsUser = new UpmsUser();
|
||||
|
@ -51,4 +56,20 @@ public class UpmsServiceTest {
|
|||
System.out.println(upmsUser.getUserId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectForPage() {
|
||||
// 根据条件,按页码+每页条数分页
|
||||
UpmsPermissionExample upmsPermissionExample = new UpmsPermissionExample();
|
||||
upmsPermissionExample.createCriteria()
|
||||
.andSystemIdEqualTo(1);
|
||||
List<UpmsPermission> upmsPermissions = upmsPermissionService.selectByExampleForStartPage(upmsPermissionExample, 2, 20);
|
||||
System.out.println(upmsPermissions.size());
|
||||
// 根据条件,按offset+limit分页
|
||||
upmsPermissionExample = new UpmsPermissionExample();
|
||||
upmsPermissionExample.createCriteria()
|
||||
.andSystemIdEqualTo(2);
|
||||
upmsPermissions = upmsPermissionService.selectByExampleForOffsetPage(upmsPermissionExample, 3, 5);
|
||||
System.out.println(upmsPermissions.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue