完成库房管理测试
This commit is contained in:
parent
0a5367ccfb
commit
0710879d79
77
ktg-admin/src/test/WmWarehouseUnitTest.java
Normal file
77
ktg-admin/src/test/WmWarehouseUnitTest.java
Normal file
@ -0,0 +1,77 @@
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ktg.RuoYiApplication;
|
||||
import com.ktg.mes.wm.controller.WmWarehouseController;
|
||||
import com.ktg.mes.wm.domain.WmWarehouse;
|
||||
import com.ktg.mes.wm.service.IWmWarehouseService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = RuoYiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class WmWarehouseUnitTest {
|
||||
@Autowired
|
||||
private WmWarehouseController wmWarehouseController = null;
|
||||
|
||||
@Autowired
|
||||
private IWmWarehouseService wmWarehouseService;
|
||||
|
||||
@Test
|
||||
public void add() {
|
||||
WmWarehouse wmWarehouse = new WmWarehouse();
|
||||
wmWarehouse.setWarehouseCode("WH999");
|
||||
wmWarehouse.setWarehouseName("测试库房999");
|
||||
wmWarehouse.setCharge("张三丰");
|
||||
wmWarehouse.setRemark("这是一个测试库房999");
|
||||
wmWarehouse.setAttr1("7");
|
||||
wmWarehouse.setAttr2("刀柄入库");
|
||||
wmWarehouse.setAttr3(1L);
|
||||
wmWarehouseService.insertWmWarehouse(wmWarehouse);
|
||||
System.out.println("add:" + wmWarehouse.getWarehouseId()); // 222
|
||||
}
|
||||
|
||||
@Test
|
||||
public void list() {
|
||||
List<WmWarehouse> list = wmWarehouseService.selectWmWarehouseList(new WmWarehouse());
|
||||
System.out.println("list:" + JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
// @Test TODO E
|
||||
// public void getTreeList() {
|
||||
// List<WmWarehouse> list = wmWarehouseService.getTreeList();
|
||||
// System.out.println("getTreeList:" + JSON.toJSONString(list));
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void getInfo() {
|
||||
System.out.println("getInfo:" + JSON.toJSONString(wmWarehouseService.selectWmWarehouseByWarehouseId(222L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void edit() {
|
||||
WmWarehouse wmWarehouse = new WmWarehouse();
|
||||
wmWarehouse.setWarehouseId(222L);
|
||||
wmWarehouse.setWarehouseCode("WH999EDIT");
|
||||
wmWarehouse.setWarehouseName("测试库房999EDIT");
|
||||
wmWarehouse.setCharge("张三丰");
|
||||
wmWarehouse.setFrozenFlag("N");
|
||||
wmWarehouse.setRemark("这是一个测试库房999EDIT");
|
||||
wmWarehouse.setAttr1("7");
|
||||
wmWarehouse.setAttr2("刀柄入库");
|
||||
wmWarehouse.setAttr3(1L);
|
||||
wmWarehouse.setAttr4(0L);
|
||||
int count = wmWarehouseService.updateWmWarehouse(wmWarehouse);
|
||||
System.out.println("edit:" + count);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remove() {
|
||||
Long[] ids = {222L};
|
||||
int count = wmWarehouseService.deleteWmWarehouseByWarehouseIds(ids);
|
||||
System.out.println("remove:" + count);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user