单元测试模版


​​​​​​​package com.erp.sale.impl;

import com.erp.domain.MiBbSoProjectBo;
import com.erp.domain.MiOdBl;
import com.erp.domain.MiOdBlItems;
import com.erp.domain.bo.MiOdBlBo;
import com.erp.domain.jsonbean.ActionResult;
import com.erp.mapper.MiOdBlItemsMapperExt;
import com.erp.mapper.MiOdBlMapperExt;
import com.erp.pur.MiBbSoProjectService;
import com.erp.pur.MiOdBlService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:META-INF/spring/applicationContext-service.xml",
        "classpath:META-INF/spring/applicationContext-persist.xml"})
public class TestServiceImplTest2 extends AbstractTransactionalJUnit4SpringContextTests {

    @Autowired
    MiOdBlService miOdBlService;
    @Autowired
    MiOdBlMapperExt miOdBlMapperExt;
    @Autowired
    MiOdBlItemsMapperExt miOdBlItemsMapperExt;

    @Autowired
    MiBbSoProjectService miBbSoProjectService;
    @Test
    public  void  getModelTest(){
        ActionResult<MiOdBlBo> actionResult = miOdBlService.getModel("fb79753100000e7f");
        System.out.println(actionResult.getData().toString());
    }
    @Test
    public  void  getTest(){
        MiOdBl miOdBl = miOdBlMapperExt.get("09eefefa0001357f");
        System.out.println(miOdBl.toString());
    }
    @Test
    public  void  saveTest(){
      /*  MiOdBl miOdBl = miOdBlMapperExt.get("09eefefa0001357f");

        System.out.println("测试数据u:\n"+miOdBl.toString());
        miOdBl.setId("09aafefa0001357f");
        miOdBl.setCreated_by_name("李三五");
        miOdBl.setCreated_time(new Date());
        miOdBlMapperExt.save(miOdBl);*/
        MiOdBlItems miOdBlItems = miOdBlItemsMapperExt.get("23a70bdb0000000a");
        miOdBlItems.setId("dvvvv0bdb0000088b");
        miOdBlItems.setGoods_name("第liuh 个后端框架");
        miOdBlItems.setCreated_by_name("小米管理");
        miOdBlItemsMapperExt.save(miOdBlItems);
        System.out.println("创建提单的明细数据:***\n"+miOdBlItems.toString());
        //System.out.println("新创建的提单信息数据:\n"+miOdBl.toString());
    }

    @Test
    public  void  delModelTest(){
        ActionResult<MiOdBlBo> actionResult = miOdBlService.getModel("fb79753100000e7f");
        System.out.println(actionResult.getResult());
    }

    @Test
    public  void  updateTest(){
        MiOdBl miOdBl =new MiOdBl();
        //miOdBlMapperExt.get("09eefefa0001357f");
        miOdBl.setId("09eefefa0001357f");
        miOdBl.setUpdated_by_name("高经理");
        miOdBl.setVersion(5);
        System.out.println(miOdBl.toString());
        int updateRow = miOdBlMapperExt.update(miOdBl);
        System.out.println(updateRow); /* */
    }

    //项目列表测试
    @Test
    public void getProjetcsPage(){
        MiBbSoProjectBo miBbSoProjectBo=new MiBbSoProjectBo();
        miBbSoProjectBo.setProject_name("东");
        //miBbSoProjectBo.setProject_code("2015082401");
        List<MiBbSoProjectBo> miBbSoProjectBoList= miBbSoProjectService.getProjetcsPage(miBbSoProjectBo);
        System.out.println("***共查询出符合条件的***:"+miBbSoProjectBoList.size());

    }

    /**
     * 提单列表查询
     */
    @Test
    public void getPage(){
        List<MiOdBlBo> miOdBlBoPageList = miOdBlService.getPage(null);
        System.out.println("共计提单:"+miOdBlBoPageList.size());

    }

}

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页