Skip to content

Null pointer using withEqualsForFieldsMatchingRegexes when values are null #3034

@UncleInf

Description

@UncleInf

When using withEqualsForFieldsMatchingRegexes and both original and compare values are null NPE is thrown in:

/assertj-core-3.24.2-sources.jar!/org/assertj/core/api/recursive/comparison/RecursiveComparisonDifferenceCalculator.java:172

getCustomErrorMessage does not have custom message registered and tries getting from value's class, and since value is null we get a NPE.

Since withErrorMessageForFields does not work for regexp values there is no way to walkaround this.
Having ability to have custom message for regexp values would be also great, but I guess this is out of scope for this ticket.

  • assertj core version: 3.24.2
  • java version: 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions