Honor map key comparison semantics with containsOnly assertions - #2167
Conversation
3d329ad to
4e38f37
Compare
|
The build fails due to too many lib to shade, not a blocker right now for us to play with objenesis |
|
I am not sure that using Have a look at my additional test cases in filiphr@96360d7. Using A potential (not 100% cases solution) would be to only create a copy if the map is a case insensitive map. e.g. like in filiphr@d7a77b9. |
|
thanks for fixing the pom @scordio. |
|
I try to summarize the topic to see if I got it correctly. The
Elements can be either keys or entries depending on the specific assertion. Checking the expected elementsThe check should always be performed on This is mostly relevant with special implementations like Finding of unexpected elementsIn the ideal case, we want to have a copy of the map and remove the expected elements, so what is left are the unexpected elements. Being able to do this strongly depends on the map implementation.
@joel-costigliola @filiphr what do you think about this approach? Do you see any other cases to be handled? |
|
Sounds good to me, a few comments:
|
|
I think that your approach @scordio makes sense.
@joel-costigliola |
256201f to
a4d8b16
Compare
4f0ee04 to
ae8bbe6
Compare
|
@joel-costigliola @filiphr Most likely this PR will also include |
|
Having the same pattern for I will focus on |
containsOnly assertions
containsOnly assertionscontainsOnly assertions
joel-costigliola
left a comment
There was a problem hiding this comment.
I still have to look at the tests but I thought I'll share my comments on the rest of the code
joel-costigliola
left a comment
There was a problem hiding this comment.
just some minor code cleanup and we are good to go!
This appears to have broken in PR assertj#2167 specifically with the use of `Map.remove(Object, Object)` that does not perform deep equality checking on the map entry value (e.g. arrays).
This affects:
assertContainsOnlyassertContainsOnlyKeysOpen points:
Maps_assertContainsOnlyKeys_TestMaps_assertContainsOnly_TestassertDoesNotContainKeys(AssertionInfo, Map, Object[])Check List:
containsOnlyassertions don't work correctly with case insensitive keys #2159