Привет, я сравниваю два объекта (используя Javers 3.9.4), которые имеют структуру, подобную приведенной ниже:
MyClass имеет несколько полей, некоторые из которых являются объектами со списками.
Список объектов показывает изменения, даже если они одинаковы в обоих экземплярах объектов
Class MyClass{
String s1;
Services services;
}
Class Services{
ServiceS1 serviceS1;
ServiceS2 services2;
}
Class ServiceS1{
String id;
List devicesS1List;
}
Class ServiceS1Devices{
String id;
String name;
Date date;
}
I create objects like this
ServiceS1Devices sd1 = new ServiceS1Devices("1", "d1", 1-2);
ServiceS1Devices sd2 = new ServiceS1Devices("2", "d2", 1-2);
List devicesS1List = new ArrayList<>();
devicesS1List.add(sd1);
devicesS1List.add(sd1);
ServiceS1 serviceS1 = new ServiceS1();
serviceS1.setId("ss1");
serviceS1.setDevicesS1List(devicesS1List);
Services services = new Services();
services.setServiceS1(serviceS1);
.... services.setServiceS2(serviceS2);
MyClass obj1 = new MyClass();
obj1.setS1("1");
obj1.setServices(services);
Create a exactly similar object with only one change like below:
MyClass obj2 = new MyClass();
obj2.setS1("2");
Everything else is same, the Services etc
Then I do a compare
Javers javers = JaversBuilder.javers()
.withListCompareAlgorithm(LEVENSHTEIN_DISTANCE)
.build();
Diff diff = javers.compare(obj1, obj2);
It gives me following output:
changes - ListChange:3 ValueChange:1
Ожидается изменение значения 1, почему оно отображается, так как список тоже изменился (в данном случае не ожидается)?
Спасибо!