https://kotlinlang.org logo
#stdlib
Title
d

ddsoyka

08/31/2017, 5:20 PM
is it safe to call
Copy code
assertEquals(byteArray, otherByteArray)
and receive the expected result? Or do I need to call
Copy code
Arrays.equals()
instead?
i

ilya.gorbunov

09/01/2017, 3:15 PM
You can use
array contentEquals otherArray
to compare two arrays by content and then assert that the result is true. Or you can wrap these arrays in lists and compare that lists:
assertEquals(byteArray.asList(), otherByteArray.asList())
d

ddsoyka

09/01/2017, 3:22 PM
Thank you, that's exactly the solution I was looking for!
This is much nicer:
Copy code
assertTrue(bytes contentEquals image!!.data)
i

ilya.gorbunov

09/01/2017, 3:24 PM
The disadvantage of that is when it fails, you'll get a message, something like "expected true, got false".
5 Views