Mockito: assertEquals on two lists, comparing object variables
<p>I want to use <code>assertEquals()</code> on the two lists <code>list1</code> and <code>list2</code>.</p>

<p>The problem is, that I don't want to compare the lists like <code>assertEquals(list1, list2)</code>. The elements are objects that can return their ids with a function <code>getId()</code>, and I want to check if the lists are equal in terms of the ids (ordered!).</p>

<p>How can I do that? Is functional programming a good idea?</p>