- List list = vars.getObject("phones");
- ArrayList cities = new ArrayList();
- Map map = new HashMap();
-
- for (int i = 0; i < list.size(); i++) {
- String s = list.get(i).get("phone");
- vars.put("phone_"+(i+1), s);
-
- String city = list.get(i).get("city");
- // cities.add(city);
- map.put(s, city);
- }
-
- vars.putObject("cities", map);
- import com.alibaba.fastjson.JSONObject;
-
- String response = prev.getResponseDataAsString();
- log.info(response);
- JSONObject object = JSONObject.parseObject(response);
- JSONObject object1 = object.getJSONObject("response");
- JSONObject object2 = object1.getJSONObject(vars.get("phoneNum"));
- String location = object2.getString("location");
-
- Map cities = vars.getObject("cities");
- String city = cities.get(vars.get("phoneNum"));
- log.info("city: " + city);
-
- if (location.contains(city)) {
- Failure= true ;
- FailureMessage = "expect city is: " + city + " ,real location is: " + location;
- }
-