Explore topic-wise MCQs in Junit.

This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Junit knowledge and support exam preparation. Choose a topic below to get started.

1.

ExpectedException is found under which package?

A. org.junit.ExpectedException
B. org.junit.Test.ExpectedException
C. org.junit.Rule.ExpectedException
D. org.junit.rules.ExpectedException
Answer» E.
2.

The _________ rule can be used to test both exception type and message.

A. Expected
B. ExpectedException
C. CatchException
D. Catch
Answer» C. CatchException
3.

With the expected argument, one cannot ___________

A. Test a method
B. Test for exception type
C. Test the value of the message in the exception
D. Test for specific exception
Answer» D. Test for specific exception