Given the following (quick and missing) code:
class Pair{
int x;
int y;
}
List l1 = Arrays.asList(new Match(1,2), new Match(1,3), new Match(2,3));
List l2 = Arrays.asList(new Match(1,2), new Match(1,3), new Match(2,3));
How can I compare the content of the lists? Everything I used so far checked if the objects themselves were equal and not the objects value:
assertThat(l1).isEqualTo(l2);
assertThat(l1).containsAll(l2);
assertThat(l1).containsExactly(values);
assertThat(l1).containsExactlyElementsOf(iterable);
Must I implement equals() method for Match class?
May this be the correct way?
for (int i = 0; i < l1.size(); i++){
assertThat(l1.get(i)).usingRecursiveComparison().isEqualTol2.get(i));
}