编写库区管理单元测试

This commit is contained in:
刘名喜 2024-11-06 16:06:12 +08:00
parent 682bc52c77
commit b82c30fc27

View File

@ -0,0 +1,62 @@
import com.alibaba.fastjson.JSON;
import com.ktg.RuoYiApplication;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.service.IWmStorageLocationService;
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 WmStorageLocationUnitTest {
@Autowired
private IWmStorageLocationService wmStorageLocationService;
@Test
public void add() {
WmStorageLocation wmStorageLocation = new WmStorageLocation();
wmStorageLocation.setLocationCode("L061");
wmStorageLocation.setLocationName("测试库区001");
wmStorageLocation.setWarehouseId(210L);
wmStorageLocation.setRemark("则是一个测试库区");
wmStorageLocation.setLocationName("原料仓");
wmStorageLocationService.insertWmStorageLocation(wmStorageLocation);
System.out.println("add" + wmStorageLocation.getLocationId()); // 227
}
@Test
public void list() {
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(new WmStorageLocation());
System.out.println("list" + JSON.toJSONString(list));
}
@Test
public void getInfo() {
System.out.println("getInfo" + JSON.toJSONString(wmStorageLocationService.selectWmStorageLocationByLocationId(227L)));
}
@Test
public void edit() {
WmStorageLocation wmStorageLocation = new WmStorageLocation();
wmStorageLocation.setRemark("这是一个测试库区");
wmStorageLocation.setLocationId(227L);
wmStorageLocation.setLocationCode("L061");
wmStorageLocation.setLocationName("原料仓");
wmStorageLocation.setWarehouseId(210L);
wmStorageLocation.setAreaFlag("N");
wmStorageLocation.setFrozenFlag("N");
int count = wmStorageLocationService.updateWmStorageLocation(wmStorageLocation);
System.out.println("edit" + count);
}
@Test
public void remove() {
Long[] ids = {227L};
int count = wmStorageLocationService.deleteWmStorageLocationByLocationIds(ids);
System.out.println("remove" + count);
}
}