单元测试

yun-zuoyi
yunhao.wang 7 years ago
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…
Cancel
Save