单元测试
parent
b5d18b4847
commit
356f23fd18
@ -0,0 +1,104 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ISysConfigService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysConfig;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 系统参数服务测试
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-30 10:49
|
||||
* @Modify :
|
||||
**/
|
||||
public class TestSysConfigServiceImpl extends TestBase {
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 测试 查询所有系统参数
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testListSysConfig() {
|
||||
List list = sysConfigService.ListSysConfig();
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id查询系统参数
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testGetSysConfigById() {
|
||||
SysConfig sysConfig = sysConfigService.getSysConfigById("1057110061127700480");
|
||||
System.out.println(JSON.toJSONString(sysConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 添加系统参数
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback(false)
|
||||
public void testInsertSysConfig() {
|
||||
SysConfig sysConfig = new SysConfig();
|
||||
sysConfig.setName("系统名称");
|
||||
sysConfig.setConfigCode("sys_name");
|
||||
sysConfig.setConfigTypeId(1);
|
||||
sysConfig.setConfigValue("IMPP");
|
||||
sysConfig.setConfigDescription("系统名称");
|
||||
|
||||
sysConfigService.insertSysConfig(sysConfig);
|
||||
System.out.println(JSON.toJSONString(sysConfig));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 修改系统参数
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testUpdateSysConfig(){
|
||||
SysConfig sysConfig = sysConfigService.getSysConfigById("1057110613261684736");
|
||||
sysConfig.setConfigDescription("测试修改");
|
||||
|
||||
sysConfigService.updateSysConfig(sysConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id删除系统参数
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testDeleteSysConfigById(){
|
||||
sysConfigService.deleteSysConfigById("1057111616417566720");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试 复制查询
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testQuerySysConfigByPager(){
|
||||
SysConfig sysConfig = new SysConfig();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setPageSize(10);
|
||||
pager.setCurrentPage(1);
|
||||
|
||||
ListPager list = sysConfigService.querySysConfigByPager(sysConfig,pager);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysDictionary;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 测试字典服务接口
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-30 18:52
|
||||
* @Modify :
|
||||
**/
|
||||
public class TestSysDictionaryServiceImpl extends TestBase {
|
||||
@Autowired
|
||||
private ISysDictionaryService sysDictionaryService;
|
||||
|
||||
|
||||
/**
|
||||
* 测试 查询所有字典
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testListSysDictionary() {
|
||||
List list = sysDictionaryService.listSysDictionary();
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id查询字典
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testGetSysDictionaryById() {
|
||||
SysDictionary sysDictionary = sysDictionaryService.getSysDictionaryById("1057110061127700480");
|
||||
System.out.println(JSON.toJSONString(sysDictionary));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 添加字典
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback(false)
|
||||
public void testInsertSysDictionary() {
|
||||
SysDictionary sysDictionary = new SysDictionary();
|
||||
sysDictionary.setName("字典测试");
|
||||
sysDictionary.setDictionaryCode("dic_test");
|
||||
sysDictionary.setDictionaryValue("TEST");
|
||||
sysDictionary.setDictionaryDescription("字典测试");
|
||||
|
||||
sysDictionaryService.insertSysDictionary(sysDictionary);
|
||||
System.out.println(JSON.toJSONString(sysDictionary));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 修改字典
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testUpdateSysDictionary(){
|
||||
SysDictionary sysDictionary = sysDictionaryService.getSysDictionaryById("1057110613261684736");
|
||||
sysDictionary.setName("测试修改");
|
||||
|
||||
sysDictionaryService.updateSysDictionary(sysDictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id删除字典
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testDeleteSysDictionaryById(){
|
||||
sysDictionaryService.deleteSysDictionaryById("1057111616417566720");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试 复杂查询
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testQuerySysDictionaryByPager(){
|
||||
SysDictionary sysDictionary = new SysDictionary();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setPageSize(10);
|
||||
pager.setCurrentPage(5);
|
||||
|
||||
ListPager list = sysDictionaryService.querySysDictionaryByPager(sysDictionary,pager);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService;
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.IToolTypeService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.ToolType;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 测试 硬件类型服务接口
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-30 20:36
|
||||
* @Modify :
|
||||
**/
|
||||
public class TestToolTypeServiceImpl extends TestBase {
|
||||
@Autowired
|
||||
private IToolTypeService toolTypeService;
|
||||
|
||||
/**
|
||||
* 测试 查询所有硬件类型
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testListToolType() {
|
||||
List list = toolTypeService.listToolType();
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id查询硬件类型
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testGetToolTypeById() {
|
||||
ToolType toolType = toolTypeService.getToolTypeById("1057110061127700480");
|
||||
System.out.println(JSON.toJSONString(toolType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 添加硬件类型
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback(false)
|
||||
public void testInsertToolType() {
|
||||
ToolType toolType = new ToolType();
|
||||
toolType.setName("扫描枪");
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
toolType.setId(null);
|
||||
toolType.setName("扫描枪"+i);
|
||||
toolTypeService.insertToolType(toolType);
|
||||
}
|
||||
System.out.println(JSON.toJSONString(toolType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 修改硬件类型
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testUpdateToolType(){
|
||||
ToolType toolType = toolTypeService.getToolTypeById("1057110613261684736");
|
||||
toolType.setName("测试修改");
|
||||
|
||||
toolTypeService.updateToolType(toolType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id删除硬件类型
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testDeleteToolTypeById(){
|
||||
toolTypeService.deleteToolTypeById("1057111616417566720");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试 复杂查询
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testQueryToolTypeByPager(){
|
||||
ToolType toolType = new ToolType();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setPageSize(10);
|
||||
pager.setCurrentPage(5);
|
||||
|
||||
ListPager list = toolTypeService.queryToolTypeByPager(toolType,pager);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue