midje

Yehonathan Sharvit 2021-03-07T16:03:14.000200Z

Is there a way to make  byte arrays comparable by value, in the context of of a unit test. For example, I’d like to write a midje prerequesite with a byte array argument, something like this:

(fact … (provided (foo (.getBytes "abc")) => nil)
The problem is that two byte arrays generated from the same string are not equal in Java (for good reasons, because a byte array is mutable)
(.equals (.getBytes "aaa")
         (.getBytes "aaa")) ; => false