Merge branch 'master' of http://git.estsh.com/i3-IMPP/i3plus-core
commit
f5732c6ffb
@ -0,0 +1,42 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.IPositionService;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : wei.peng
|
||||
* @Date : 2018-10-29 19:12
|
||||
* @Modify :
|
||||
**/
|
||||
//@SpringBootTest
|
||||
//@RunWith(SpringRunner.class)
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@AutoConfigureMockMvc
|
||||
public class TestBase {
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
System.out.println("-----------------开始测试-----------------");
|
||||
}
|
||||
|
||||
@After
|
||||
public void after() {
|
||||
System.out.println("-----------------测试结束-----------------");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.IPositionService;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.Position;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 岗位信息测试
|
||||
* @Reference :
|
||||
* @Author : wei.peng
|
||||
* @Date : 2018-10-29 19:02
|
||||
* @Modify :
|
||||
**/
|
||||
public class TestPositionServiceImpl extends TestBase {
|
||||
|
||||
@Autowired
|
||||
private IPositionService positionService;
|
||||
|
||||
/**
|
||||
* 测试获取 所有岗位
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testListPosition() {
|
||||
List list = positionService.listPosition();
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键查询测试
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testGetPositionById() {
|
||||
Position position = positionService.getPositionById("1056796316849541120");
|
||||
System.out.println(JSON.toJSONString(position));
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据 测试
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testInsertPosition() {
|
||||
Position position = new Position();
|
||||
position.setName("张三的岗位");
|
||||
position.setPositionCode("ZS_CODE");
|
||||
position.setPositionDescription("描述该岗位的信息");
|
||||
Position pos = positionService.insertPosition(position);
|
||||
System.out.println(JSON.toJSONString(pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据测试
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testDeletePositionById() {
|
||||
positionService.deletePositionById("105605611393555");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据测试
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testUpdatePosition(){
|
||||
Position position = positionService.getPositionById("1056878692237709312");
|
||||
position.setName("===>> 改动后的名称");
|
||||
positionService.updatePosition(position);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue