编写计量单位单元测试
This commit is contained in:
parent
7ee4ba745d
commit
2de329dd62
78
ktg-admin/src/test/MdUnitMeasureUnitTest.java
Normal file
78
ktg-admin/src/test/MdUnitMeasureUnitTest.java
Normal file
@ -0,0 +1,78 @@
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ktg.RuoYiApplication;
|
||||
import com.ktg.mes.md.domain.MdUnitMeasure;
|
||||
import com.ktg.mes.md.service.IMdUnitMeasureService;
|
||||
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 MdUnitMeasureUnitTest {
|
||||
@Autowired
|
||||
private IMdUnitMeasureService mdUnitMeasureService;
|
||||
|
||||
@Test
|
||||
public void add() {
|
||||
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
|
||||
mdUnitMeasure.setMeasureCode("打");
|
||||
mdUnitMeasure.setMeasureName("一打");
|
||||
mdUnitMeasure.setPrimaryFlag("Y");
|
||||
mdUnitMeasure.setEnableFlag("Y");
|
||||
mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure);
|
||||
System.out.println("add:" + mdUnitMeasure.getMeasureId()); // 225
|
||||
}
|
||||
|
||||
@Test
|
||||
public void list() {
|
||||
List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(new MdUnitMeasure());
|
||||
System.out.println("list:" + JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInfo() {
|
||||
System.out.println("getInfo:" + JSON.toJSONString(mdUnitMeasureService.selectMdUnitMeasureByMeasureId(225L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void edit() {
|
||||
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
|
||||
mdUnitMeasure.setMeasureId(225L);
|
||||
mdUnitMeasure.setMeasureCode("dozen");
|
||||
mdUnitMeasure.setMeasureName("一打");
|
||||
mdUnitMeasure.setPrimaryFlag("Y");
|
||||
mdUnitMeasure.setEnableFlag("Y");
|
||||
int count = mdUnitMeasureService.updateMdUnitMeasure(mdUnitMeasure);
|
||||
System.out.println("edit:" + count);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remove() {
|
||||
Long[] ids = {225L};
|
||||
int count = mdUnitMeasureService.deleteMdUnitMeasureByMeasureIds(ids);
|
||||
System.out.println("remove:" + count);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listPrimary() {
|
||||
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
|
||||
mdUnitMeasure.setPrimaryFlag("Y");
|
||||
List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
|
||||
System.out.println("listPrimary:" + JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectAll() {
|
||||
MdUnitMeasure mdUnitMeasure = new MdUnitMeasure();
|
||||
mdUnitMeasure.setEnableFlag("Y");
|
||||
List<MdUnitMeasure> list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure);
|
||||
System.out.println("selectAll:" + JSON.toJSONString(list));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user