单元测试案例(白盒测试)

2019独角兽企业重金招聘Python工程师标准>>> hot3.png


package com.pingan.stock.oas.app.openacc.action;


import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.pingan.pafa.papp.test.BaseSARTest;
import com.pingan.pafa.papp.test.SARContextConfiguration;
import com.pingan.stock.oas.admin.core.action.OasVideoHangupReasonCfgAction;
import com.pingan.stock.oas.common.web.form.OASVideoHangupReasonCfgForm;
import com.pingan.stock.oas.common.web.vo.RemVO;

@SARContextConfiguration(sarList = "oas_admin_core", protocols = "jetty") //这个开发框架输入@会自动带出后面的类和参数说明
public class OasVideoHangupReasonCfgActionTest extends BaseSARTest{
       
       @Autowired    //这个是加的注解,手动输入的
       private OasVideoHangupReasonCfgAction cfgAction;
       
       @Test    //这个也可以手动输入
       public void test_add(){
              OASVideoHangupReasonCfgForm cfgForm = new OASVideoHangupReasonCfgForm();
              cfgForm.setName_zh("aaaaaaaaaaaaa");
              cfgForm.setDisplay_name("aaaaaaaa");
              cfgForm.setChannel_id("ydkh");
              try {
                     RemVO remVO = cfgAction.addHangupReasonCfg(cfgForm);
                     String str = JSON.toJSONString(remVO);
                     System.err.println(str);
              } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
              }
       }
       
       @Test
       public void test_update(){
              OASVideoHangupReasonCfgForm cfgForm = new OASVideoHangupReasonCfgForm();
              cfgForm.setName_zh("bbbbbbbbbbbbbbbbbbbb");
              cfgForm.setDisplay_name("bbbbb");
              cfgForm.setChannel_id("ydkh");
              cfgForm.setId("8A2AD090DB504D0AE0537AAF190AE576");
              try {
                     RemVO remVO = cfgAction.updateHangupReasonCfg(cfgForm);
                     String str = JSON.toJSONString(remVO);
                     System.err.println(str);
              } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
              }
       }
       
       @Test
       public void test_delete(){
              String idStr = "8A2AD090DB504D0AE0537AAF190AE576";
              try {
                     RemVO remVO = cfgAction.deleteHangupReasonCfg(idStr);
                     String str = JSON.toJSONString(remVO);
                     System.err.println(str);
              } catch (Exception e) {
                     e.printStackTrace();
              }
       }
       
       @Test
       public void test_query(){
              OASVideoHangupReasonCfgForm cfgForm = new OASVideoHangupReasonCfgForm();
              cfgForm.setName_zh("客户端挂断");
//            cfgForm.setDisplay_name("bbbbb");
//            cfgForm.setChannel_id("ydkh");
//            cfgForm.setId("8A2AD090DB504D0AE0537AAF190AE576");
              try {
                     RemVO remVO = cfgAction.queryHangupReasonCfg(cfgForm);
                     String str = JSON.toJSONString(remVO);
                     System.err.println(str);
              } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
              }
       }
       
}

 

转载于:https://my.oschina.net/u/3563297/blog/3058848

你可能感兴趣的:(单元测试案例(白盒测试))