JUnit4 fail() is here, but where is pass()?

后端 未结 6 947
闹比i
闹比i 2020-12-14 05:39

There is a fail() method in JUnit4 library. I like it, but experiencing a lack of pass() method which is not present in the library. Why is it so?

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-14 05:57

    There is no need for the pass method because when no AssertionFailedException is thrown from the test code the unit test case will pass.

    The fail() method actually throws an AssertionFailedException to fail the testCase if control comes to that point.

提交回复
热议问题