Skip to content

Incorrect change reported for maps with array-typed values #546

Description

@neal-erickson

Was trying to find an existing issue for this, but couldn't - might not have done a good job though! I'm working with your otherwise excellent library for comparing some kafka serialization classes I'm writing and found an odd behavior. One of the objects I'm comparing has a field of type Map<String, UUID[]> and when I serialize/deserialize it I find that Javers reports a MapChange change for that value, despite the UUID within the array being identical. This simple JUnit test reproduces the issue:

@Test
public void checkMapEqualitySane() {

    UUID uuid = UUID.randomUUID();
    UUID[] array1 = new UUID[1];
    UUID[] array2 = new UUID[1];
    array1[0] = uuid;
    array2[0] = uuid;
    String key = "1";

    Map<String, UUID[]> map1 = new HashMap<>();
    map1.put(key, array1);
    Map<String, UUID[]> map2 = new HashMap<>();
    map2.put(key, array2);

    Diff diff = JaversBuilder.javers().build().compare(map1, map2);
    assertFalse(diff.hasChanges());
}

Let me know if I'm missing something obvious here, but I couldn't find anything. Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions