Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show why there was a mismatch #1360

Closed
robstoll opened this issue Mar 17, 2023 · 2 comments
Closed

show why there was a mismatch #1360

robstoll opened this issue Mar 17, 2023 · 2 comments

Comments

@robstoll
Copy link
Owner

Platform (all, jvm, js): all
Extension (none, kotlin 1.3): none

Code related feature

expect(listOf(person1, person2, ...)).toHaveElementsAndAll { 
  age.toBeGreaterThanOrEqual(18) 
  zip.notToEqual(null)
  city.notToEqual(null)
}

in reporting we see currently

I expected subject: [Person(..), Person(...)]
◆ elements need all: 
    » age
      » to be greater than or equal: 18
    » zip
      » not to equal: null
    »  city 
      » not to equal: null
    ❗❗ following elements were mismatched: 
       ⚬ index 0: Person(...)
       ⚬ index 1: Person(...)

Depending on the representation of Person it is possible to see why it mismatches but it is cumbersome as one has to manually scan the output and see why it failed. I would like to see all failing assertions per mismatch:

I expected subject: [Person(..), Person(...)]
◆ elements need all: 
    » age
      » to be greater than or equal: 18
    » zip
      » not to equal: null
    »  city 
      » not to equal: null
    ❗❗ following elements were mismatched: 
       ⚬ index 0: Person(...)
          > age: 10
            * to be greater than or equal: 18
       ⚬ index 1: Person(...)
          > city: null
            * not to equal: null

This closely relates to #724 and I think we should also provide a report option which allows to define if we show also successful assertions or not

@vlsi
Copy link
Collaborator

vlsi commented Mar 17, 2023

I think you just duplicated #1359

@robstoll
Copy link
Owner Author

Haha... 10min difference, I should have written faster :D
Going to merge the two 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants