Olete.in
Articles
Mock Tests
🧪 Maven MCQ Quiz Hub
Maven Mcq Set 1
Choose a topic to test your knowledge and improve your Maven skills
1. The __________ package contains plugins that make it easier to use jMock with legacy code.
org.jmock.api
org.jmock.lib.action
org.jmock.lib.script
org.jmock.lib.legacy
2. _____________ class enables to imposterise abstract and concrete classes without calling the constructors of the mocked class.
ClassImposteriser
Imposteriser
ImposterisingClass
Imposter
3. ________ method reports if the Imposteriser is able to imposterise a given type.
canImposterise(Class<?> type)
Imposterise(Class<?> type)
imposterise(Invokable mockObject, Class<T> mockedType, Class<?>… ancilliaryTypes)
imposter()
4. ___________ creates an imposter for a given type that forwards Invocations to an Invokable object.
canImposterise(Class<?> type)
Imposterise(Class<?> type)
imposterise(Invokable mockObject, Class<T> mockedType, Class<?>… ancilliaryTypes)
imposter()
5. The mockObject parameter of imposterise() is the class representing the static type of the imposter.
True
False
none
all the mentoined
6. The ancilliaryTypes parameter of the imposterise() function must all be interfaces.
True
False
all of the mentioned
None of the mentioned
7. The __________ package contains plugins that make it easier to write custom actions by scripting their behaviour with BeanShell.
org.jmock.api
org.jmock.lib.action
org.jmock.lib.script
org.jmock.lib.legacy
8. ________ class is an Action that executes a BeanShell script.
ScriptedAction
Scripted
Action
ScriptedActionClass
9. ______ method performs an action in response to an invocation.
describeTo(Description description)
invoke(Invocation invocation)
perform(String script)
where(String name, Object value)
10. The invoke method throws which exception?
ArrayIndexOutOfBounds
StringIndexOutOfBounds
Throwable
NullPointer
11. _____ creates an action that performs the given script.
describeTo(Description description)
invoke(Invocation invocation)
perform(String script)
where(String name, Object value)
12. _______ defines a variable that can be referred to by the script.
describeTo(Description description)
invoke(Invocation invocation)
perform(String script)
where(String name, Object value)
13. _______ package contains actions that fake the behavior of mocked invocations.
org.jmock
org.jmock.lib.action
org.jmock.lib
org.jmock.lib.script
14. ______ returns the next of a sequence of elements each time it is invoked.
ActionSequence
CustomAction
DoAllAction
ReturnValueAction
15. The exception thrown by the ActionSequence mehod is _____
NullPointer
Throwable
ArrayIndexOutOfBounds
Arithmetic
16. _____ is a partial implementation of the Action interface that making it easy to implement actions specific to applications with inline anonymous classes.
ActionSequence
CustomAction
DoAllAction
ReturnValueAction
17. _______ performs multiple actions every time it is invoked.
ActionSequence
CustomAction
DoAllAction
ReturnValueAction
18. ________ returns an Enumeration over a collection.
ActionSequence
CustomAction
DoAllAction
ReturnEnumerationAction
19. ________ returns an iterator over a collection.
ActionSequence
CustomAction
ReturnIteratorAction
ReturnEnumerationAction
20. The VoidAction class throws an exception.
True
False
none
all the mentoined
21. _____ translates ExpectationErrors into JUnit’s AssertionFailedErrors.
JUnit3ErrorTranslator
JUnit3Mockery
MockObjectTestCase
VerifyingTestCase
22. _______ is a Mockery that reports expectation errors as JUnit 3 test failures.
JUnit3ErrorTranslator
JUnit3Mockery
MockObjectTestCase
VerifyingTestCase
23. _____ is a TestCase that supports testing with mock objects.
JUnit3ErrorTranslator
JUnit3Mockery
MockObjectTestCase
VerifyingTestCase
24. ______ is a TestCase that verifies postconditions after the test has run and before the fixture has been torn down.
JUnit3ErrorTranslator
JUnit3Mockery
MockObjectTestCase
VerifyingTestCase
25. To write a mock object test in JUnit 3, MockObject needs to be extended.
True
False
none
all the mentoined
26. A _________ is a JUnit Rule that manages JMock expectations and allowances.
JunitRuleMockery
JmockRuleMockery
JunitRule
JunitMockery
27. The _____ class provides factory methods for the executor services provided in the package.
Executors
Exceptions
ReadOnly
AbstractMock
28. A _____ offers services for the components it’s hosting, such as lifecycle, security, transaction, distribution, and so forth.
Component
Container
Mock
Appraisal
29. Stubs work well to ________ a given class for testing and asserting the state of its instances.
Delete
Enhance
Isolate
Append
30. Stubs test the behavior of faked objects.
True
False
none
all the mentoined
31. The biggest advantage of mock objects over in-container testing is that mocks don’t require a ________ container in order to execute tests.
Running
Closed
Open
static
32. ______ contains helper classes for ant properties.
org.apache.tools.ant.property
org.apache.tools.ant.types
org.apache.tools.ant.util
org.apache.tools.ant.taskdefs
33. ______ is the interface to a class to get a property in apache ant.
ParseNextProperty
PropertyExpander
GetProperty
LocalProperties
34. _____ is a thread local class containing local properties.
ParseNextProperty
PropertyExpander
GetProperty
LocalProperties
35. ______ is the class to resolve properties in a map.
LocalPropertyStack
ResolvePropertyMap
NullReturn
ParseProperties
36. ______ parses properties using a collection of expanders.
LocalPropertyStack
ResolvePropertyMap
NullReturn
ParseProperties
37. _______ is a class to represent a null and to stop the chain of lookups.
LocalPropertyStack
ResolvePropertyMap
NullReturn
ParseProperties
38. _______ interface is used by ant attributes.
EnableAttribute
PropertyExpander
GetProperty
LocalProperties
39. _______ class is used to indicate that the XML namespace (URI) can be used to look for namespace attributes.
AttributeNamespace
BaseIfAttribute
IfBlankAttribute
IfSetAttribute
40. ______ is an abstract class for if/unless attributes.
AttributeNamespace
BaseIfAttribute
IfBlankAttribute
IfSetAttribute
41. JUnit runners are available in which package?
org.junit.runners
junitfiles.runners
org.runners
org.junit.files.runners
42. To start a test case as JUnit 3.8 test case which runner is required?
org.junit.runners.Junit4
org.junit.runners.Parameterized
org.junit.internal.runners.Junit38ClassRunner
org.junit.internal.runners.Junit4
43. What is a Façade in JUnit?
It is a group of test cases
It is a design pattern that provides a unified interface to a set of interfaces in a subsystem
It is a collection of superclasses
It is a group of mock objects
44. To create a custom test runner which class needs to be extended?
CustomRunner
TestRunner
Runner
UserRunner
45. What type of object is returned on completion of a test?
org.junit.runner.Result
org.junit.runner.Complete
org.junit.runner.Outcome
org.junit.runner.Object
46. To listen to events during a test, which class has to be extended?
org.junit.runner.notification.RunListener
org.junit.runner.Listener
org.junit.runner.notification.Listener
org.junit.runner.RunListener
47. When does the wasSuccessful() method of the Runner class return true?
The test file compiled
The test file ran
Some of the test cases ran successfully
All the test cases ran succesfully
48. To run the file TestClass.class from the command line, we have to type what?
java TestClass
javac TestClass
java org.junit.runner.JUnitCore TestClass
org.junit.runner.JUnitCore TestClass
49. What does the getRunCount() method of the Result return?
String denoting the time of execution
Integer denoting the time of execution
int denoting the number of tests run
int denoting the number of failed tests
50. What information does an object of the Failure class contain?
Description of the failed test
Description of the failed test and the exception thrown while running it
Description of the fail() method
Description of the exception thrown
Submit