字段类型为SortedSet的类不会显示在更改中。
class TestClass{
String id;
Set<String> set;
SortedSet<String> sortedSet;
}
private void runTest(){
Javers javers = JaversBuilder
.javers()
.withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE)
.registerEntity(new EntityDefinition(TestClass.class, "id"))
.build();
TestClass tc1 = new TestClass();
tc1.id = "1";
tc1.set = new HashSet<>(Collections.singletonList("StringInSet1"));
tc1.sortedSet = new TreeSet<>(Collections.singletonList("StringInSortedSet1"));
TestClass tc2 = new TestClass();
tc2.id = "1";
tc2.set = new HashSet<>(Collections.singletonList("StringInSet2"));
tc2.sortedSet = new TreeSet<>(Collections.singletonList("StringInSortedSet2"));
Diff diff = javers.compare(tc1, tc2);
System.out.println(diff.changesSummary());
}
实际结果:更改-SetChange:1 预期结果:更改-SetChange:2
答案 0 :(得分:0)
已修复https://github.com/javers/javers/issues/888:
修复了当属性类型是基本可枚举类型的子类型(例如,SortedMap,SortedSet等)时,生成更改时的回归