编写出入库类型单元测试

This commit is contained in:
刘名喜 2024-11-06 16:17:26 +08:00
parent b82c30fc27
commit 7fc5556b57
3 changed files with 68 additions and 0 deletions

View File

@ -10,6 +10,9 @@ 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 WmStorageLocationUnitTest {

View File

@ -10,6 +10,9 @@ 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 {

View File

@ -0,0 +1,62 @@
import com.alibaba.fastjson.JSON;
import com.ktg.RuoYiApplication;
import com.ktg.mes.md.domain.WmsBusinessType;
import com.ktg.mes.md.service.IWmsBusinessTypeService;
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 WmsBusinessTypeUnitTest {
@Autowired
private IWmsBusinessTypeService wmsBusinessTypeService;
@Test
public void add() {
WmsBusinessType wmsBusinessType = new WmsBusinessType();
wmsBusinessType.setCode("TYPE_UNIT_TEST_01");
wmsBusinessType.setName("出库单元测试数据01");
wmsBusinessType.setFlag("2");
wmsBusinessType.setRemark("出库单元测试数据01");
wmsBusinessTypeService.insertWmsBusinessType(wmsBusinessType);
System.out.println("add" + wmsBusinessType.getTypeId()); // 14
}
@Test
public void list() {
List<WmsBusinessType> list = wmsBusinessTypeService.selectWmsBusinessTypeList(new WmsBusinessType());
System.out.println("list" + JSON.toJSONString(list));
}
@Test
public void getInfo() {
System.out.println("getInfo" + JSON.toJSONString(wmsBusinessTypeService.selectWmsBusinessTypeByTypeId("14")));
}
@Test
public void edit() {
WmsBusinessType wmsBusinessType = new WmsBusinessType();
wmsBusinessType.setTypeId("14");
wmsBusinessType.setCode("TYPE_UNIT_TEST_02");
wmsBusinessType.setName("出库单元测试数据02");
wmsBusinessType.setFlag("2");
wmsBusinessType.setRemark("出库单元测试数据02");
int count = wmsBusinessTypeService.updateWmsBusinessType(wmsBusinessType);
System.out.println("edit" + count);
}
@Test
public void remove() {
String[] ids = {"14"};
int count = wmsBusinessTypeService.deleteWmsBusinessTypeByTypeIds(ids);
System.out.println("remove" + count);
}
}