From 37037940da6e82bf4cae1377a8b3f87ad2f51bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=8D=E5=96=9C?= Date: Thu, 7 Nov 2024 11:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99BOM=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-admin/src/test/BomRouteUnitTest.java | 66 ++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 ktg-admin/src/test/BomRouteUnitTest.java diff --git a/ktg-admin/src/test/BomRouteUnitTest.java b/ktg-admin/src/test/BomRouteUnitTest.java new file mode 100644 index 0000000..7ee3483 --- /dev/null +++ b/ktg-admin/src/test/BomRouteUnitTest.java @@ -0,0 +1,66 @@ +import com.alibaba.fastjson.JSON; +import com.ktg.RuoYiApplication; +import com.ktg.mes.md.domain.BomRoute; +import com.ktg.mes.md.service.IBomRouteService; +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.ArrayList; +import java.util.List; + +/** + * BOM管理单元测试 + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RuoYiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class BomRouteUnitTest { + @Autowired + private IBomRouteService bomRouteService; + + @Test + public void add() { + BomRoute bomRoute = new BomRoute(); + bomRoute.setBomCode("UNIT_TEST_002"); + bomRoute.setBomName("单元测试002"); + bomRoute.setBomVersion("V1.0"); + bomRoute.setMdItemId(75L); + bomRoute.setIsDefault("true"); + bomRoute.setMbbProduBomList(new ArrayList<>()); + bomRouteService.insertBomRoute(bomRoute); + System.out.println("add:" + bomRoute.getBomRouteId()); // 10 + } + + @Test + public void list() { + List list = bomRouteService.selectBomRouteList(new BomRoute()); + System.out.println("list:" + JSON.toJSONString(list)); + } + + @Test + public void getInfo() { + System.out.println("getInfo:" + JSON.toJSONString(bomRouteService.selectBomRouteByBomRouteId(10L))); + } + + @Test + public void edit() { + BomRoute bomRoute = new BomRoute(); + bomRoute.setBomRouteId(10L); + bomRoute.setBomName("单元测试001"); + bomRoute.setBomVersion("V1.0"); + bomRoute.setMdItemId(75L); + bomRoute.setIsDefault("true"); + bomRoute.setMbbProduBomList(new ArrayList<>()); + int count = bomRouteService.updateBomRoute(bomRoute); + System.out.println("edit:" + count); + } + + @Test + public void remove() { + Long[] ids = {10L}; + int count = bomRouteService.deleteBomRouteByBomRouteIds(ids); + System.out.println("remove:" + count); + } +}