小编Sob*_*rma的帖子

gradle、cucumber 和 selenium 的警告

我正在我的自动化项目中工作,我在 IntelliJ 中使用带有硒和黄瓜的 java 10 实现了 gradle。

但是当我运行我的项目时,我收到以下警告,但我无法解决它。任何帮助将不胜感激。

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by cucumber.deps.com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/sobhit.s/.gradle/caches/modules-2/files-2.1/info.cukes/cucumber-jvm-deps/1.0.5/69ed0efe4b81f05da3c0bdc7281cbdc43f5ceb26/cucumber-jvm-deps-1.0.5.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of cucumber.deps.com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Run Code Online (Sandbox Code Playgroud)

selenium cucumber gradle cucumber-jvm build.gradle

5
推荐指数
0
解决办法
2677
查看次数

解析JSON多个对象

我正在尝试解析以下json,但由于出现堆栈溢出错误而无法做到这一点。

这是JSON-

[{
    "Class": "1",
    "school": "test",
    "description": "test",
    "student": [
        "Student1",
        "Student2"
    ],
    "qualify": true,
    "annualFee": 3.00
}]
Run Code Online (Sandbox Code Playgroud)

这是当前失败的代码。

String res  = cspResponse.prettyPrint();
org.json.JSONObject obj = new org.json.JSONObject(res);
org.json.JSONArray arr = obj.getJSONArray(arrayName);
String dataStatus=null;

for (int i = 0; i < arr.length(); i++) {
    dataStatus = arr.getJSONObject(i).getString(key);
    System.out.println("dataStatus is \t" + dataStatus);
}
Run Code Online (Sandbox Code Playgroud)

用例是:

  1. 获取值键“类”
  2. 从学生那里获得价值
  3. 从学校获得价值

我感谢您的帮助。

update-1 使用以下详细信息更新有关堆栈跟踪的更多信息。cls = 1

错误- org.json.JSONException: JSONObject["student "] not a string.

堆栈跟踪-

public String getString(String key) throws JSONException {
        Object object …
Run Code Online (Sandbox Code Playgroud)

java parsing json

1
推荐指数
1
解决办法
94
查看次数

标签 统计

build.gradle ×1

cucumber ×1

cucumber-jvm ×1

gradle ×1

java ×1

json ×1

parsing ×1

selenium ×1