I want to test the value of hole set with .body sentence in REST Assured. when i use this code only get some error...
BannerDto resultBannerDto = given()
.contentType("application/json")
.body(bannerAddDto)
.when()
.post("/api/v1/admin/banners")
.then()
.statusCode(HttpStatus.OK.value())
.contentType(ContentType.JSON)
.body("name", equalTo("banner A"))
//this line make error:
.body("regions", equalTo(regionsSet.toString()))
.extract().as(BannerDto.class);
while error is:
java.lang.AssertionError: 1 expectation failed.
JSON path regions doesn't match.
Expected: [1, 2]
Actual: [1, 2]
parameter regionsSet is:
private Set<Long> regionsSet = new HashSet<>();
regionsSet.add(1l);
regionsSet.add(2l);
and original response is:
Actual: {regions=[1, 2], endDate=2017-05-01T22:00:00, productIds=[], bannerId=15,...
please help me find out whats wrong?
Aucun commentaire:
Enregistrer un commentaire