-1

Classes with fields of type SortedSet do not show up in the changes.

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());
    }

Actual Result: changes - SetChange:1 Expected Result: changes - SetChange:2

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

Fixed in https://github.com/javers/javers/issues/888:

Fixed the regression in generating changes when property types are sub-types of base enumerable types (e.g., SortedMap, SortedSet, etc.)