异乡客

我一生戎马刀上飘 见过英雄弯下小蛮腰 飞檐走壁能飞多高 我坐船练习水上漂

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

//将返回值的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     }
View Code

 

posted on 2015-09-08 11:41  cvv54  阅读(278)  评论(0编辑  收藏  举报