Why doesn't JUnit provide assertNotEquals methods?

后端 未结 11 1125
忘了有多久
忘了有多久 2020-12-12 08:30

Does anybody know why JUnit 4 provides assertEquals(foo,bar) but not assertNotEqual(foo,bar) methods?

It provides assertNotSame

11条回答
  •  我在风中等你
    2020-12-12 09:13

    It's better to use the Hamcrest for negative assertions rather than assertFalse as in the former the test report will show a diff for the assertion failure.

    If you use assertFalse, you just get an assertion failure in the report. i.e. lost information on cause of the failure.

提交回复
热议问题