I want to assert that the object array in the JSON response is ordered alphabetically based on one of the properties of the object (this is in ReadyAPI). I've tried this a number of ways but can't get it to work. This is what I've got:
json = new groovy.json.JsonSlurper().parseText(context.response)
assert json.data[0].foundPatientDisplayNaam.contains(context.expand('${Blaauw}'))
var lastItem = json.data.size()-1
assert json.data[lastItem].foundPatientDisplayNaam.contains(context.expand('${Ziende}'))
I've also tried solutions with ResponseAsXml#count(//*:foundPatientDisplayNaam, .last() and .length-1.
I suspect I'm missing some basic knowledge here but still, thanks in advance to anyone who's able to help me out here.