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.

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.
advertisement

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.

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.
Free 30-Day Java Certification Bootcamp is Live. Join Now!

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.

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.
advertisement

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
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
I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

If you’re in your 40s–60s and exploring new directions in your career, I also offer mentoring. Learn more here.