GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Recursive comparison fails if ignored fields are not found in `expected` · Issue #3226 · assertj/assertj

Recursive comparison fails if ignored fields are not found in expected #3226

New issue
Copy link
New issue
Copy link
Closed
🐛 Bug
Closed
Recursive comparison fails if ignored fields are not found in expected#3226
🐛 Bug
Copy link
Assignees
joel-costigliola
Labels
theme: recursive comparisonAn issue related to the recursive comparison
Milestone
3.27.0

Description

@scordio
scordio
opened on Oct 17, 2023
Issue body actions

Source: #2115 (comment)

Example

Map<String, Object> mapA = Map.of("foo", "bar",
                                  "description", "foobar",
                                  "submap", Map.of("subFoo", "subBar", "description", "subFooBar"));
Map<String, Object> mapB = Map.of("foo", "bar",
                                  "description", "barfoo",
                                  "submap", Map.of("subFoo", "subBar"));

// should work but fails
assertThat(mapA).usingRecursiveComparison()
                .ignoringFields("description", "submap.description")
                .isEqualTo(mapB);
assertThat(mapA).usingRecursiveComparison()
                .ignoringFieldsMatchingRegexes(".*description")
                .isEqualTo(mapB);
java.lang.AssertionError: 
Expecting actual:
  {"description"="foobar", "foo"="bar", "submap"={"description"="subFooBar", "subFoo"="subBar"}}
to be equal to:
  {"description"="barfoo", "foo"="bar", "submap"={"subFoo"="subBar"}}
when recursively comparing field by field, but found the following difference:

field/property 'submap' differ:
- actual value  : {"description"="subFooBar", "subFoo"="subBar"}
- expected value: {"subFoo"="subBar"}
actual and expected values are maps of different size, actual size=2 when expected size=1

Activity

  1. scordio
    added
    type: bug
    theme: recursive comparisonAn issue related to the recursive comparison
    on Oct 17, 2023
  2. scordio
    changed the title [-] Recursive comparison fails if ignored fieds are not in the expected #2115 [/-] [+] Recursive comparison fails if ignored fieds are not in the expected[/+] on Oct 17, 2023
  3. scordio
    changed the title [-] Recursive comparison fails if ignored fieds are not in the expected[/-] [+] Recursive comparison fails if ignored fieds are not in `expected`[/+] on Oct 17, 2023
  4. scordio
    changed the title [-] Recursive comparison fails if ignored fieds are not in `expected`[/-] [+] Recursive comparison fails if ignored fieds are not found in `expected`[/+] on Oct 17, 2023
  5. scordio
    removed
    type: bug
    on Oct 2, 2024
  6. joel-costigliola
    self-assigned this
    on Jan 1, 2025
  7. scordio
    added this to the 3.27.1 milestone on Jan 1, 2025
  8. joel-costigliola
    closed this as completedin 6ea4d4fon Jan 1, 2025
  9. scordio commented on Jan 2, 2025

    @scordio
    scordio
    on Jan 2, 2025
    MemberAuthor
    More actions

    Likely fixed by 835c1dc.

  10. scordio
    modified the milestones: 3.27.1, 3.27.0 on Jan 2, 2025
  11. scordio
    changed the title [-] Recursive comparison fails if ignored fieds are not found in `expected`[/-] [+] Recursive comparison fails if ignored fields are not found in `expected`[/+] on Jan 2, 2025
  12. mat3e
    added a commit that references this issue on Jan 3, 2025

    Recursive comparison: add test with ignored fields in nested map

    This issue will close once commit 6ea4d4f is merged into the '3.x' branch.
    6ea4d4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @joel-costigliola
    joel-costigliola

Labels

theme: recursive comparisonAn issue related to the recursive comparison

Type

🐛 Bug

Projects

No projects

    Milestone

    • 3.27.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.