https://kotlinlang.org logo
#kotest
Title
# kotest
f

franztesca

09/24/2023, 11:13 AM
Hello! I have two `ByteArray`s, I want to assert that their content is the same, but there is not one that is expected/actual, so shouldBe is quite deceiving. My test is like:
Copy code
val byteArray1 = generateByteArrayInAFancyWay1()
val byteArray2 = generateByteArrayInAFancyWay2()
byteArray1 shouldBe byteArray2 // here the message becomes deceiving if the bug is in generateByteArrayInAFancyWay2()
What is the best way to assert here, with minimal and semantically expressive code and meaningful assertion error message?
s

sam

09/25/2023, 12:15 AM
Maybe something like (byteArray1 == byteArray2) shouldBe true
a

alex.krupa

09/26/2023, 6:46 AM
You could try clues to print more info with the error. Not very minimal, it can be extracted, but at that point you might as well consider just writing your own assertion for this use case.