import org.json.*; //導入json包
String response = prev.getResponseDataAsString(); //擷取響應的值
JSONObject responseJson = new JSONObject(response); //轉換成json格式
String message = responseJson.getString("message"); //擷取請求的message字段
log.info("響應message字段:" + message); //
if (message.equals("處理成功")){
Failure = false;
}
else{
Failure = true;
FailureMessage = "響應字段不是處理成功";
}
String code = responseJson.getString("code");
log.info("響應code字段:" + code);
if (code.equals("0000")){
Failure = false; //斷言成功
}
else{
Failure = true; //斷言失敗
FailureMessage = "響應狀态碼不是000"; //自定義反回資訊
}