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
Explanation:JUnit3ErrorTranslator translate Expectation Errors into JUnit AssertionFailedErrors.
a) JUnit3ErrorTranslator
b) JUnit3Mockery
c) MockObjectTestCase
d) VerifyingTestCase
View Answer
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
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
Explanation: VerifyingTestCase is a class that verifies post conditions.
5. To write a mock object test in JUnit 3, MockObject needs to be extended.
a) True
b) False
View Answer
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
Explanation: JunitRuleMockery asserts that expectations have been met after each test has finished.
7. The __________ class provides factory methods for the executor services provided in the package.
a) Executors
b) Exceptions
c) ReadOnly
d) AbstractMock
View Answer
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
Explanation: A component executes in a container.
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
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
Explanation: In stubs, specialized methods are required to verify states.
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]
- Apply for Computer Science Internship
- Check JUnit Books
- Practice Programming MCQs
- Check Programming Books