What's the best way to assert that two ByteArrays ...
# kotest
k
What's the best way to assert that two ByteArrays are the same (as per
contentEquals
)?
l
The quickest way is
toList()
on both sides and don't think about arrays
I do believe that 'shouldBe' handles it. I was looking for prove but couldn't find yet. You can probably use
arrA shouldBe arrB
k
Thanks. I thought
shouldBe
used
equals
.
l
It does use equals but for special cases it will make some transformations beforehand. For our case here Arrays
👍 1
k
Thanks, I confirm
shouldBe
works.
a
shouldContainExactly
gives a more detailed description of differences
k
Thanks, that's true. It doesn't work on arrays, but you can do
actualByteArray.asIterable() shouldContainExactly expectedByteArray.asIterable()