Trying to assert 2 lists but it fails:
I'm trying to compare two List
objects.
Here's my test class.
public class RestServiceTest {
HttpClient http = new HttpClient();
private Gson gson = new Gson();
@Test
public void getAllEmployeesTest() throws IOException {
HttpResponse response = http.get("http://localhost:8087/employee");
List<Employee> expectedList = new ArrayList<>();
expectedList.add(new Employee(2, "Yashwant", "Chavan", 30, false));
Type listType = new TypeToken<ArrayList<Employee>>() {}.getType();
List<Employee> actualList = gson.fromJson(EntityUtils.toString(response.getEntity()), listType);
System.out.println(actualList);
System.out.println(expectedList);
Assert.assertEquals(actualList,expectedList);
}
}