Home / CSE MCQs / JUnit MCQs :: Discussion

Discussion :: JUnit MCQs

  1. What does the fail() method do in JUnit?
  2. A.
    Throws an assertion error unconditionally
    B.
    Calls the default constructor
    C.
    Outputs the message Fail" to the console
    D.
    Pauses the test for 1 second

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    The method throws an assertion error unconditionally. This might be helpful to show an incomplete test (maybe still being worked upon) or to ensure that an expected exception is thrown.


Be The First To Comment