JUnit Questions and Answers – Maven Surefire

This set of JUnit Multiple Choice Questions & Answers (MCQs) focuses on “Maven Surefire”.

1. ____________ translates ExpectationErrors into JUnit’s AssertionFailedErrors.
a) JUnit3ErrorTranslator
b) JUnit3Mockery
c) MockObjectTestCase
d) VerifyingTestCase
View Answer

Answer: a
Explanation:JUnit3ErrorTranslator translate Expectation Errors into JUnit AssertionFailedErrors.
2. ___________ is a Mockery that reports expectation errors as JUnit 3 test failures.
a) JUnit3ErrorTranslator
b) JUnit3Mockery
c) MockObjectTestCase
d) VerifyingTestCase
View Answer
Answer: a
Explanation: JUnit3Mockery is used to report expectation errors.

3. __________ is a TestCase that supports testing with mock objects.
a) JUnit3ErrorTranslator
b) JUnit3Mockery
c) MockObjectTestCase
d) VerifyingTestCase
View Answer

Answer: a
Explanation: MockObjectTestCase is used for testing mock objects.

4. ____________ is a TestCase that verifies postconditions after the test has run and before the fixture has been torn down.
a) JUnit3ErrorTranslator
b) JUnit3Mockery
c) MockObjectTestCase
d) VerifyingTestCase
View Answer

Answer: a
Explanation: VerifyingTestCase is a class that verifies post conditions.
advertisement
advertisement

5. To write a mock object test in JUnit 3, MockObject needs to be extended.
a) True
b) False
View Answer

Answer: b
Explanation: To write a mock object test in JUnit 3, MockObjectTestCase needs to be extended.

6. A _________ is a JUnit Rule that manages JMock expectations and allowances.
a) JunitRuleMockery
b) JmockRuleMockery
c) JunitRule
d) JunitMockery
View Answer

Answer: a
Explanation: JunitRuleMockery asserts that expectations have been met after each test has finished.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

7. The __________ class provides factory methods for the executor services provided in the package.
a) Executors
b) Exceptions
c) ReadOnly
d) AbstractMock
View Answer

Answer: a
Explanation: The Executors class has factory methods for the executor services.

8. A __________ offers services for the components it’s hosting, such as lifecycle, security, transaction, distribution, and so forth.
a) Component
b) Container
c) Mock
d) Appraisal
View Answer

Answer: b
Explanation: A component executes in a container.
advertisement

9. Stubs work well to ________ a given class for testing and asserting the state of its instances.
a) Delete
b) Enhance
c) Isolate
d) Append
View Answer

Answer: c
Explanation: Stubbing a servlet container allows us to track how many requests were made, what the state of the server is, or what URL s where requested.

10. Stubs test the behavior of faked objects.
a) True
b) False
View Answer

Answer: b
Explanation: In stubs, specialized methods are required to verify states.
advertisement

Sanfoundry Global Education & Learning Series – JUnit.
To practice all areas of Junit, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.