使用Java库“ javers”比较功能是否支持SortedSet中的更改?

问题描述 投票:-1回答:1

具有类型为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

java javers
1个回答
0
投票

固定在https://github.com/javers/javers/issues/888

修复了当属性类型是基本可枚举类型的子类型(例如,SortedMap,SortedSet等)时,在生成更改时的回归问题

© www.soinside.com 2019 - 2024. All rights reserved.