这是我收到回复后的代码。
response.then().assertThat().body("documents[0].items[0].price.sales_tax_summary[0].rate",equalTo("0.0"));
这是响应日志:
{
"id": "quote-1",
"documents": [
{
"id": "document-1",
"items": [
{
"id": "2",
"price": {
"amount_inclusive": 200000.5,
"amount_exclusive": 200000.5,
"total_tax": 0.0,
"tax_rate": 0.0,
"sales_tax_summary": [
{
"rate": 0.0,
"amount": 0.0
},
{
"rate": 0.0,
"amount": 0.0
}
]
}
}
],
"shipping": {
"id": "3",
"price": {
"amount_inclusive": 15.0,
"amount_exclusive": 15.0,
"total_tax": 0.0,
"tax_rate": 0.0,
"sales_tax_summary": [
{
"rate": 0.0,
"amount": 0.0
},
{
"rate": 0.0,
"amount": 0.0
}
]
}
},
"handling": {
"id": "4",
"price": {
"amount_inclusive": 5.0,
"amount_exclusive": 5.0,
"total_tax": 0.0,
"tax_rate": 0.0,
"sales_tax_summary": [
{
"rate": 0.0,
"amount": 0.0
},
{
"rate": 0.0,
"amount": 0.0
}
]
}
}
}
]
}
这是错误消息
java.lang.AssertionError: 1 expectation failed.
JSON path documents[0].items[0].price.sales_tax_summary[0].rate doesn't match.
Expected: 0.0
Actual: 0.0
我尝试修剪,使用包含子字符串,插入 0.0 作为双精度值而不是预期的字符串。但得到了同样的错误