Is it possible to configure Javers so that when comparing two objects which have a String property that has the value null or "" (empty) String it will not find any difference. Basically treat null and "" empty string the same. For example:
Class Phone
{
String phoneNumber;
Phone(phoneNumber)
{
this.phoneNumber = phoneNumber;
}
}
Phone phoneNumber = new PhoneNumber("");
Phone phoneNumber1 = new PhoneNumber(null);
I would like that when these 2 objects will be compared by Javers, it will show no difference.
You can register a custom comparator for Values. It's explained in JaVers doc - https://javers.org/documentation/domain-configuration/#ValueType
Javers javers = JaversBuilder.javers()
.registerValue(String.class, (a, b) -> StringUtils.equals(a,b)).build();