title: Comparing two list of objects in JUnit
body: <p>I am writing JUnit Test case for my java project and using Coverage Tool to check the lines of code are covered. The problem is: I've two list of objects. I need to compare the results of object to be equal using assertTrue or any other possible assert statements. I am getting error like Assertion Error by using below assert statements. Is there any solution to compare two lists easily?</p>
  
  <pre><code>//actual    
  List&lt;ProjectData&gt; actuals = ProjectManagerDao.getProjects("x", "y", "z");
  // expected
  List&lt;ProjectData&gt; expecteds = new ArrayList&lt;&gt;();
  ProjectData p1 = new ProjectData();
  p1.setId("a");
  p1.setName("b");
  expecteds.add(p1);
  
  assertTrue(JsonProvider.getGson().toJson(actuals).equalsIgnoreCase(JsonProvider.getGson().toJson(expecteds)));
  //or
  assertTrue(actuals.equalIgnoreCase(expeteds);//Not working for list of objects but working for comparing two strings
  </code></pre>
  
  <p>This differs from <a href="https://stackoverflow.com/questions/2762093/java-compare-two-lists">Java Compare Two Lists</a> in that I need to be able to assert equality in jUnit, not just compare the lists.</p>