响应不匹配(尽管匹配)

  • 本文关键字:不匹配 响应 java rest
  • 更新时间 :
  • 英文 :


有人能协助断言以下内容吗:

String Givencoordinates = "[[-45.85112, 18.17335], [-45.85164, 18.173283], [-45.85283, 18.17247]]"

想要用以下代码断言上面的字符串:

given()
.get(apiUrl)
.then()
.assertThat()
.body(“angle", equalTo(Collections.singletonList(120)))
.body("coordinates", equalTo((Collections.singletonList(Givencoordinates)));

第一步(身体角度(正在通过,但第二步会出现以下错误:

JSON path coordinates doesn't match.
Expected: <[[-45.85112, 18.17335], [-45.85164, 18.173283], [-45.85283, 18.17247]]>
Actual: [[-45.85112, 18.17335], [-45.85164, 18.173283], [-45.85283, 18.17247]]

尝试使用(Collections.singletonList(Givencoordinates(&断言中有(Arrays.asList(Givencoordinates(,但得到了相同的错误。

这个错误的解决方案是什么?谢谢

Junit输出在数据上调用toString

您应该尝试将期望值定义为实际列表,而不是将单个字符串放入一个元素的列表中

最新更新