5
测试用例
@Test
public void test02() throws Exception {
JSONObject responseData = new JSONObject();
Integer status=1;
List<Map<String,Object>> list=new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("file_type","auth_protocol");
map.put("file_path","http");
list.add(map);
responseData.put("data",list);
responseData.put("status",status);
String s = JSONObject.toJSONString(responseData);
TestResp testResp = JSON.parseObject(s, TestResp.class);
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TestResp implements Serializable {
public final static long serialVersionUID=1L;
@JsonProperty(value = "status")
private Integer status;
@JsonProperty(value = "data")
private List<Data> data;
/**
get、set方法省略
**/
}
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Data implements Serializable {
public final static long serialVersionUID=1L;
@JsonProperty(value = "file_type")
private String fileType;
@JsonProperty(value = "file_path")
private String filePath;
/**
get、set方法省略
**/
}