Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
additional isEqualTo API #119
It would be nice to have be able to write:
which would under the hood use a comparator that is doing a reflection equals (similiar to the one in org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals ) only on specified fields.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Have a look at lenient equals assertions, I think they'll do the job
// frodo and sam both are hobbits, so they are lenient equals on race assertThat(frodo).isLenientEqualsToByAcceptingFields(sam, "race");
// Except name and age, frodo and sam both are hobbits, so they are lenient equals ignoring name and age assertThat(frodo).isLenientEqualsToByIgnoringFields(sam, "name", "age");
examples from BasicAssertionsExamples.java in fest-examples project.