JUnit Questions and Answers – Maven Plug-ins

«
»

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

1. ____________ translates ExpectationErrors into AssertionErrors that several test frameworks, including JUnit 4 and TestNG, use to report errors.
a) AssertionErrorTranslator
b) CamelCaseNamingScheme
c) CurrentStateMatcher
d) IdentityExpectationErrorTranslator
View Answer

Answer: a
Explanation: The AssertionErrorTranslator is a class that translates ExpectationErrors into AssertionErrors.
2. _________ is a naming scheme wherein the implicit name for a mock object is the mocked type’s name with the first character represented in lower case.
a) AssertionErrorTranslator
b) CamelCaseNamingScheme
c) CurrentStateMatcher
d) IdentityExpectationErrorTranslator
View Answer
Answer: b
Explanation: The CamelCaseNamingScheme is the class which defines a naming for mock objects.
advertisement

3. __________ is an ExpectationErrorTranslator that doesn’t do any translation.
a) AssertionErrorTranslator
b) CamelCaseNamingScheme
c) CurrentStateMatcher
d) IdentityExpectationErrorTranslator
View Answer

Answer: d
Explanation: IdentityExpectationErrorTranslator returns the ExpectationError it is given.

4. __________ is an Imposteriser that uses the Proxy class of the Java Reflection API.
a) AssertionErrorTranslator
b) CamelCaseNamingScheme
c) JavaReflectionImposteriser
d) IdentityExpectationErrorTranslator
View Answer

Answer: c
Explanation: The JavaReflectionImposteriser class makes use of the Proxy class of the Java Reflection API.

5. ___________ is a naming scheme in which the implicit name for a mock object is the last word of the mocked type’s name in lower case.
a) AssertionErrorTranslator
b) CamelCaseNamingScheme
c) JavaReflectionImposteriser
d) LastWordNamingScheme
View Answer

Answer: d
Explanation: The LastWordNamingScheme class defines a naming scheme for mock objects.
advertisement

6. __________ is a naming scheme in which the implicit name for a mock object is the mocked type’s name prepend with “mock”.
a) RetroNamingScheme
b) CamelCaseNamingScheme
c) JavaReflectionImposteriser
d) LastWordNamingScheme
View Answer

Answer: a
Explanation: The RetroNamingScheme class defines a naming scheme with the prefix of “mock” for mock objects.

7. __________ function translates the given ExpectationError into an error type compatible with another testing framework.
a) change()
b) translate()
c) compatible()
d) mock()
View Answer

Answer: b
Explanation: Translate() returns an error that is compatible with another testing framework and contains the same message and stack trace as the passed parameter.

8. ___________ interface defines a sequence of expectations.
a) Sequence
b) States
c) Expectations
d) Mockery
View Answer

Answer: a
Explanation: Invocations can be constrained to occur in a strict order defined by a sequence.
advertisement

9. __________ is an interface which defines a state machine that is used to constrain the order of invocations.
a) Sequence
b) States
c) Expectations
d) Mockery
View Answer

Answer: b
Explanation: The States interface defines the state machine.

10. ____________ class represents the context, or neighborhood, of the object(s) under test.
a) Sequence
b) States
c) Expectations
d) Mockery
View Answer

Answer: d
Explanation: The Mockery class represents the context under test.

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

advertisement

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn