New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion error when comparing field by field is no longer as informative #1158
Comments
I agree the error is not helpful, thanks for reporting this ! |
I was thinking to change the error returned to show all the missing fields, ex: Employee employee = new Employee();
EmployeeOfTheMonth employeeOfTheMonth = new EmployeeOfTheMonth();
assertThat(employeeOfTheMonth).isEqualToComparingFieldByFieldRecursively(employee); The assertion fails with the error:
@markstamatiades WDYT ? |
Looks reasonable to me. So if there is more than one missing field it will list them all rather than just the first one it hits, right? |
What would the message be if the fields had the same name but were of differing types? |
@markstamatiades yes it would show all the missing fields |
In AssertJ 3.6.2, an IntrospectionError was thrown when a field or property was missing/different when comparing one object to another of two different types. In this case, Person contains FirstName and LastName whereas PersonDAO contains Firstname and Lastname.
In 3.7.0 and above, only the following is returned:
Requires a lot more work to figure out exactly why the assertion fails, especially when the objects become much more complex and interfaces are included. Would be good if the original error information could be returned like it was in 3.6.2.
The text was updated successfully, but these errors were encountered: