From cb36f8e28b2e1b8a8fc9947996f96d4c67b2a9bf 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:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E6=96=99=E7=AE=B1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=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/UcmCtBaseUnitTest.java | 61 +++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 ktg-admin/src/test/UcmCtBaseUnitTest.java diff --git a/ktg-admin/src/test/UcmCtBaseUnitTest.java b/ktg-admin/src/test/UcmCtBaseUnitTest.java new file mode 100644 index 0000000..c401dc1 --- /dev/null +++ b/ktg-admin/src/test/UcmCtBaseUnitTest.java @@ -0,0 +1,61 @@ +import com.alibaba.fastjson.JSON; +import com.ktg.RuoYiApplication; +import com.ktg.mes.wm.domain.UcmCtBase; +import com.ktg.mes.wm.service.IUcmCtBaseService; +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; + +/** + * 料箱管理单元测试 + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RuoYiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class UcmCtBaseUnitTest { + @Autowired + private IUcmCtBaseService ucmCtBaseService; + + @Test + public void add() { + UcmCtBase ucmCtBase = new UcmCtBase(); + ucmCtBase.setCode("UNIT_TEST_02"); + ucmCtBase.setType("0"); + ucmCtBase.setBaseKnifeList(new ArrayList<>()); + ucmCtBaseService.insertUcmCtBase(ucmCtBase); + System.out.println("add:" + ucmCtBase.getCtBaseId()); // 13 + } + + @Test + public void list() { + List list = ucmCtBaseService.selectUcmCtBaseList(new UcmCtBase()); + System.out.println("list:" + JSON.toJSONString(list)); + } + + @Test + public void getInfo() { + System.out.println("getInfo:" + JSON.toJSONString(ucmCtBaseService.selectUcmCtBaseByCtBaseId("13"))); + } + + @Test + public void edit() { + UcmCtBase ucmCtBase = new UcmCtBase(); + ucmCtBase.setCtBaseId("13"); + ucmCtBase.setCode("UNIT_TEST_01"); + ucmCtBase.setType("0"); + ucmCtBase.setBaseKnifeList(new ArrayList<>()); + int count = ucmCtBaseService.updateUcmCtBase(ucmCtBase); + System.out.println("edit:" + count); + } + + @Test + public void remove() { + String[] ids = {"13"}; + int count = ucmCtBaseService.deleteUcmCtBaseByCtBaseIds(ids); + System.out.println("remove:" + count); + } +}