编写料箱管理单元测试

This commit is contained in:
刘名喜 2024-11-07 11:20:43 +08:00
parent 2883858168
commit cb36f8e28b

View File

@ -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<UcmCtBase> 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);
}
}