【发布时间】:2016-04-11 22:04:58
【问题描述】:
我正在我的 Java Spring Web 应用程序中运行我的集成测试套件,但是遇到了以下错误。
有一个单独的项目值:id 的 {id value},在响应中返回。
java.lang.AssrtionError: 1 expectation failed.
JSON path data.id doesn't match.
Expected: a collection containing "BUNDLE_A"
Actual: BUNDLE_A
IntegrationTest.java:
@Test
public void testBundle() throws Exception {
RestAssured.when()
.get("v1/bundles/{bundleId}", TEST_BUNDLE_ID)
.then()
.statusCode(HttpStatus.OK.value())
.body("data.id", hasItem(TEST_BUNDLE_ID))
.body("errorCode", nullValue());
}
【问题讨论】:
标签: java spring junit hamcrest