0
私はspring mvcを使用して残りのWebサービスをテストするためにRestAssuredにテストケースを作成しています。RestAssuredテストのhateoas
残り応答が
{
"links": [
{
"rel": "self",
"href": "http://www.localhost.com:8080/v1/communities?offset=0&limit=10"
},
{
"rel": "next",
"href": "http://www.localhost.com:8080/v1/communities?offset=10&limit=10"
}
],
"content": [
{
.....
で、私のテストケースは、テストケースは私も
equalTo("[http://www.localhost.com:8080/v1/communities?offset=0&limit=10, http://www.localhost.com:8080/v1/communities?offset=10&limit=10");
を試してみました
java.lang.AssertionError: 1 expectation failed.
JSON path links.href doesn't match.
Expected: ["http://www.localhost.com:8080/v1/communities?offset=0&limit=10", "http://www.localhost.com:8080/v1/communities?offset=10&limit=10"]
Actual: [http://www.localhost.com:8080/v1/communities?offset=0&limit=10, http://www.localhost.com:8080/v1/communities?offset=10&limit=10]
エラーで失敗し
when().
get("/communities").
then().
root("links").
body("href", new ResponseAwareMatcher() {
public Matcher<? extends Object> matcher(ResponseBody response) {
return equalTo(new String[] {"http://www.localhost.com:8080/v1/communities?offset=0&limit=10", "http://www.localhost.com:8080/v1/communities?offset=10&limit=10"});
}
});
です
java.lang.AssertionError: 1 expectation failed.
JSON path links.href doesn't match.
Expected: [http://www.localhost.com:8080/v1/communities?offset=0&limit=10, http://www.localhost.com:8080/v1/communities?offset=10&limit=10]]
Actual: [http://www.localhost.com:8080/v1/communities?offset=0&limit=10, http://www.localhost.com:8080/v1/communities?offset=10&limit=10]
ようにして、エラーとなる10
私は休憩が3.0.1をアシュアード使用しています。あなたの助けを前もってありがとう。