Hi I want to test with assertThat
if a JSONArray contains an item with a key with a specific value.
For example I have JSONArray:
[
{
"eventType": "event_1",
"name": "user_1",
....
},
{
"eventType": "event_2",
"name": "user_2",
....
}
]
What I want to test is if this array contains an item with the key: eventType
with the value: event_2
Is it possible to achieve this with assertThat
without looping through the array and checking each item?
I know it is possible to check if a map contains a given key and value and I also know it is possible to check if an array contains given item. But I didn't found any solution how to combine both things. Someone has an idea how can I combine these two things?
Thank you for your help