1
我很難找到。 如何使用Rest-Assured從響應中驗證以下內容?如何驗證來自沒有任何數組名稱的JSON數組內容的放心答覆?
{
"code":268,
"name":"Result-Code",
"value":2001,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
如果這是我的迴應:
[
{
"avps":[
{
"code":263,
"name":"Session-Id",
"value":"ocstest;766666665;766666665",
"type":"UTF8STRING",
"group":[
],
"grouped":false
},
{
"code":260,
"name":"Vendor-Specific-Application-Id",
"value":"<Grouped>",
"type":"GROUPED",
"group":[
{
"code":265,
"name":"Supported-Vendor-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":258,
"name":"Auth-Application-Id",
"value":4,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":259,
"name":"Acct-Application-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
],
"grouped":true
},
{
"code":268,
"name":"Result-Code",
"value":2001,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":416,
"name":"CC-Request-Type",
"value":1,
"type":"INT32",
"group":[
],
"grouped":false
},
{
"code":415,
"name":"CC-Request-Number",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":431,
"name":"Granted-Service-Unit",
"value":"<Grouped>",
"type":"GROUPED",
"group":[
{
"code":420,
"name":"CC-Time",
"value":240,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
],
"grouped":true
}
]
},
{
"avps":[
{
"code":263,
"name":"Session-Id",
"value":"ocstest;766666665;766666665",
"type":"UTF8STRING",
"group":[
],
"grouped":false
},
{
"code":260,
"name":"Vendor-Specific-Application-Id",
"value":"<Grouped>",
"type":"GROUPED",
"group":[
{
"code":265,
"name":"Supported-Vendor-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":258,
"name":"Auth-Application-Id",
"value":4,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":259,
"name":"Acct-Application-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
],
"grouped":true
},
{
"code":268,
"name":"Result-Code",
"value":5004,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":416,
"name":"CC-Request-Type",
"value":2,
"type":"INT32",
"group":[
],
"grouped":false
},
{
"code":415,
"name":"CC-Request-Number",
"value":1,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
]
},
{
"avps":[
{
"code":263,
"name":"Session-Id",
"value":"ocstest;766666666;788888888",
"type":"UTF8STRING",
"group":[
],
"grouped":false
},
{
"code":260,
"name":"Vendor-Specific-Application-Id",
"value":"<Grouped>",
"type":"GROUPED",
"group":[
{
"code":265,
"name":"Supported-Vendor-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":258,
"name":"Auth-Application-Id",
"value":4,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":259,
"name":"Acct-Application-Id",
"value":0,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
],
"grouped":true
},
{
"code":268,
"name":"Result-Code",
"value":5002,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
},
{
"code":416,
"name":"CC-Request-Type",
"value":3,
"type":"INT32",
"group":[
],
"grouped":false
},
{
"code":415,
"name":"CC-Request-Number",
"value":2,
"type":"UNSIGNED32",
"group":[
],
"grouped":false
}
]
}]
如上所述,如果陣列元素的變化序列那麼就不會工作。請建議更健壯的方法。 – OverrockSTAR