0
有沒有辦法將JUnit配置爲在顯示錯誤消息時以十六進制打印整數?在JUnit失敗消息中使用十六進制
例如,有沒有辦法讓JUnit來顯示該
Failure: does_not_touch_other_bits(PackedArrayTest): expected:<0xabcd1234> but was:<0>
Tests run: 1, Failures: 1
,而不是這個
Failure: does_not_touch_other_bits(PackedArrayTest): expected:<-1430689110> but was:<0>
Tests run: 1, Failures: 1
此外,使用Assertion框架(Hamcrest,AssertJ,Truth等)併爲此編寫自定義匹配器將是一個想法,但可能是矯枉過正。 –