我具有所有值的有效JSON响应。显然,对于响应中的对象之一(“ CurrentBatchNumber”:427181),我无法声明其值。尽管该值显示在响应中,但是在代码中我无法声明其值。
==================================
then().assertThat().contentType(ContentType.JSON).and().
body("CurrentBatchNumber",equalTo("123456")).
JsonPath js= ReusableMethods.rawToJson(res);
String AC=js.get("ApprovalCode");
String RM=js.get("ResponseMessage");
String TT=js.get("TransactionType");
CBN=js.get("CurrentBatchNumber");
System.out.println("Approval Code --> "+ AC + "\n" + "Response Message -
->" + RM + "\n" + "Transaction Type -->" + TT + "\n");
System.out.println("Batch Number -->" + CBN);
==================== 控制台输出----
Approval Code --> 2542280
Response Message -->Transaction successful.
Transaction Type -->PARAMETER DOWNLOAD
Batch Number -->null
JSON path CurrentBatchNumber doesn't match.
Expected: 123456
Actual: null
============================== 正在显示在控制台中捕获的实际响应--- CurrentBatchNumber。 ===>“ CurrentBatchNumber”:427181