Skip to content

Exception when comparing actual JSON containing a no empty array to an expected JSON containing empty array #206

@georgeslb

Description

@georgeslb

Hello

considering two JSON

Actual : {a: 1, b: [{c: 1}] }
Expected : {a: 1, b:[]}

when comparing with a customCompartor on

    public final ArrayValueMatcher<Object> CUSTOM_GET_MESSAGES_MESSAGES_RESPONSE_COMPARATOR = new ArrayValueMatcher<>(new CustomComparator(
            JSONCompareMode.STRICT,
            new Customization("[**].c", this::compareUuid)));

    public final CustomComparator CUSTOM_GET_MESSAGES_RESPONSE_COMPARATOR = new CustomComparator(JSONCompareMode.STRICT,
            new Customization("b", CUSTOM_GET_MESSAGES_MESSAGES_RESPONSE_COMPARATOR));

we're getting this error

java.lang.ArithmeticException : / by zero

in class ArrayValueMatcher

Object expectedElement = expectedArray.get((i - first) % expectedLen)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions