In unit tests I usually use something like
assertThat(someObject).isEqualTo(someOtherObject);
to make sure these two objects have identical content. But what to do in case objects have identical content except certain fields?
Normally it would be like that:
assertThat(someObject.getFirstField()).isNotEqualTo(someOtherObject.getFirstField());
assertThat(someObject.getLastField()).isNotEqualTo(someOtherObject.getLastFieldd());
// and then gazilion fields that should be equal
assertThat(someObject.getNthField()).isEqualTo(someOtherObject.getNthField());
// ...
For obvious reasons, it is very unwieldy for bigger classes with a lot of fields. Is there way to specify that you expect certain fields to be not equal, but rest equal?
Both someObject and someOtherObject are same class that is Lomboked, so equals() is automatically handled.