我目前正在使用数组作为ScalaTest中数据参数化测试装置的输入,这就是我所得到的:
ArrayIndexOutOfBoundsException was thrown during property evaluation. (SortingSpec.scala:43)
Message: 2
Occurred at table row 2 (zero based, not counting headings), which had values (
Input = [I@17c386de,
Expected = [I@5af97850
)
有没有办法将这些描述变成更有意义的东西?
由于
答案 0 :(得分:4)
使用withClue
包装断言(如下所述:http://www.scalatest.org/user_guide/using_assertions)。它允许您向断言附加任意附加字符串,如果断言失败则显示该断言。为了使数组的内容更具可读性,建议对它们调用mkString("[", ",", "]")
,或者只是转换它们toList
。