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); + } +}