Open 11aescalante opened 1 month ago
This is down to kotlin using reference equality for arrays. https://blog.jetbrains.com/kotlin/2015/09/feedback-request-limitations-on-data-classes/#appendix.-comparing-arrays
We have a special-case for asserting array equality but it's not possible to extend that for all places that arrays may be used. There has been a few asks about overriding the comparison functions used in contains* methods for various reasons so I think your second example could fall under that, but we haven't designed an api for it yet.
When using
isEqualTo
to compare two ByteArrays it works by usingcontentEquals
internally. But when usingisEqualTo
on a Collection (or any Collection assert like containsOnly), it seems that it is comparing the ByteArrays by reference. These are two examples:As
containsOnly
and the other Collection variants are very useful for testing, I would expect them to compare underlying Collections with their proper comparators. Is there any chance this could be addressed in a future release?assertk version used 0.28.1