postman测试带有json数据格式的字段

测试六个字段  

普通字段: ModelCode

普通字段: MmodelCode

普通字段: ModelTagKey

普通字段: ModelTagValue

普通字段: ModelTagType

json格式字段: ModelTagvalueJson

 

写测试类生成对应json格式数据

 

package com.yqbsoft.app.wallet.com.all.pfs;

import java.util.ArrayList;
import java.util.List;

import com.yqbsoft.laser.service.producestaticfile.domain.PfsModelTagDomain;
import com.yqbsoft.laser.service.producestaticfile.domain.PfsModelTagvalueDomain;
import com.yqbsoft.laser.service.tool.util.JsonUtil;

public class TagValueTest {
public static void main(String[] args) {
List<PfsModelTagDomain> pfsModelTagDomainList=new ArrayList<PfsModelTagDomain>();
PfsModelTagDomain pfsModelTagDomain=new PfsModelTagDomain();
pfsModelTagDomain.setModelCode("01");
pfsModelTagDomain.setMmodelCode("0101");
pfsModelTagDomain.setModelTagKey("goods");
pfsModelTagDomain.setModelTagValue("goods");
pfsModelTagDomain.setModelTagType("0");
pfsModelTagDomainList.add(pfsModelTagDomain);
List<PfsModelTagvalueDomain> pfsModelTagvalueDomainList =new ArrayList<PfsModelTagvalueDomain>();
pfsModelTagDomain.setPfsModelTagvalueDomainList(pfsModelTagvalueDomainList);
PfsModelTagvalueDomain pfsModelTagvalueDomain =new PfsModelTagvalueDomain();
pfsModelTagvalueDomain.setModelTagvalueJson("{\"pm\":\"1\"}");
pfsModelTagvalueDomainList.add(pfsModelTagvalueDomain);
System.out.println(JsonUtil.buildNormalBinder().toJson(pfsModelTagDomainList));
}
}

 

Console:

[{"modelTagId":null,"modelTagCode":null,"mmodelCode":"0101","modelCode":"01","modelTagSort":null,"modelTagKey":"goods","modelTagValue":"goods","modelTagType":"0","tenantCode":null,"pfsModelTagvalueDomainList":[{"modelTagvalueId":null,"modelTagvalueCode":null,"modelTagCode":null,"mmodelCode":null,"modelCode":null,"modelTagvalueSv":null,"modelTagvalueSv1":null,"modelTagvalueSv2":null,"tenantCode":null,"modelTagvalueJson":"{\"pm\":\"1\"}"}]}]

 

在postman测试借口  saveModelTagList.json

借口:

 

 

 postman测试:

 

 

posted on 2018-06-12 17:32  shenhaha  阅读(1252)  评论(0编辑  收藏  举报

有用的话麻烦点个推荐哈