So I have two String arrays:
String[] a = {"Tony", "33", "male", "New York"};
String[] b = {"John", "33", "male", "Chicago"};
Then I have an ArrayList of HashMaps:
ArrayList<HashMap<String, String>> list =
[{"name": "John", "age": "33", "gender": "male", "city": "Chicago"}],
[{"name": "Tony", "Age": "33", "gender": "male", "city": "New York"}];
So I get array a or b first from another method. I want to then compare that the 'name' or the value at index 0 in the string a or b is the same as 'name' value in the ArrayList, String a or b value at index 1 which is '33' is the same as 'age' value in the ArrayList and so forth. I have tried the following:
for(int i = 0; i <= list.size(); i++) {
assertEquals(b[0], list.get(i).get("name"));
assertEquals(b[1], list.get(i).get("age"));
assertEquals(b[3], list.get(i).get("city"));
}
But the problem is, it works for only one of the string lists, i.e. it would only work if I get string b first because at i = 0, the ArrayList has same values as that of string b.