//将返回值的data部分序列化,取出某个参数进行assert
1 @Test 2 public void loginTest_diffDeviceToken(){ 3 String account = "xxxx"; 4 String password = "123456"; 5 Map<String,Object> m = new HashMap<String,Object>(); 6 m.put("account", account); 7 m.put("password",password); 8 String res = HTTPUtil.postJson("http://192.168.1.100/xxx.htm",JSON.toJSONString(m)); 9 ResVo resVo = JSON.parseObject(res,ResVo.class); 10 System.out.println(JSON.toJSONString(m)); 11 System.out.println(res); 12 org.junit.Assert.assertSame(0, resVo.getResult()); 13 Map<String,String> dataMap = JSON.parseObject(resVo.getData(),Map.class); 14 org.junit.Assert.assertSame(account, dataMap.get("account")); 15 }