With Rest Assured i'm parcing rest-response and comparing arrays.
Response body:
{
"error": {
"errorObjects": [
{
"risks": [
{
"description": "Risk1",
"riskId": 6654152
},
{
"description": "Risk2",
"riskId": 6654155
}
]
}
]
}
}
Arrays with expected data:
int[] riskId = {6654152, 6654155}
String[] description = {"Risk1", "Risk2"}
Rest Assured and Hamcrest Matchers asserts:
.body("error.errorObjects[0].risks.description", containsInRelativeOrder(description),
"error.errorObjects[0].risks.riskId",containsInRelativeOrder(riskId));
I'm getting an error:
java.lang.AssertionError: 1 expectation failed.
JSON path error.errorObjects[0].risks.riskId doesn't match.
Expected: ((a collection containing [<6654152>, <6654155>]))
Actual: <[6654152, 6654155]>
So it seems that it's ok with comparing array of strings but with ints it goes mad. Help me out, maybe i need to use there another matcher, not containsInRelativeOrder? I've tried many of them but anyway getting this error