Explore topic-wise MCQs in Junit.

This section includes 14 Mcqs, each offering curated multiple-choice questions to sharpen your Junit knowledge and support exam preparation. Choose a topic below to get started.

1.

The invoke method throws which exception?

A. ArrayIndexOutOfBounds
B. StringIndexOutOfBounds
C. Throwable
D. NullPointer
Answer» D. NullPointer
2.

______________ method performs an action in response to an invocation.

A. describeTo(Description description)
B. invoke(Invocation invocation)
C. perform(String script)
D. where(String name, Object valu
Answer» C. perform(String script)
3.

___________ class is an Action that executes a BeanShell script.

A. ScriptedAction
B. Scripted
C. Action
D. ScriptedActionClass
Answer» B. Scripted
4.

The ancilliaryTypes parameter of the imposterise() function must all be interfaces.

A. True
B. False
Answer» B. False
5.

_______________METHOD_PERFORMS_AN_ACTION_IN_RESPONSE_TO_AN_INVOCATION.?$

A. describeTo(Description description)
B. invoke(Invocation invocation)
C. perform(String script)
D. where(String name, Object value)
Answer» C. perform(String script)
6.

The_invoke_method_throws_which_exception?$

A. ArrayIndexOutOfBounds
B. StringIndexOutOfBounds
C. Throwable
D. NullPointer
Answer» D. NullPointer
7.

___________ class is an Action that executes a BeanShell script?

A. ScriptedAction
B. Scripted
C. Action
D. ScriptedActionClass
Answer» B. Scripted
8.

The __________ package contains plugins that make it easier to write custom actions by scripting their behaviour with BeanShell.

A. org.jmock.api
B. org.jmock.lib.action
C. org.jmock.lib.script
D. org.jmock.lib.legacy
Answer» D. org.jmock.lib.legacy
9.

The ancilliaryTypes parameter of the imposterise() function must all be interfaces.

A. True
B. False
Answer» B. False
10.

The mockObject parameter of imposterise() is the class representing the static type of the imposter.

A. True
B. False
Answer» C.
11.

___________ creates an imposter for a given type that forwards Invocations to an Invokable object.

A. canImposterise(Class<?> type)
B. Imposterise(Class<?> type)
C. imposterise(Invokable mockObject, Class<T> mockedType, Class<?>… ancilliaryTypes)
D. imposter()
Answer» D. imposter()
12.

________ method reports if the Imposteriser is able to imposterise a given type.

A. canImposterise(Class<?> type)
B. Imposterise(Class<?> type)
C. imposterise(Invokable mockObject, Class<T> mockedType, Class<?>… ancilliaryTypes)
D. imposter()
Answer» B. Imposterise(Class<?> type)
13.

_____________ class enables to imposterise abstract and concrete classes without calling the constructors of the mocked class.

A. ClassImposteriser
B. Imposteriser
C. ImposterisingClass
D. Imposter
Answer» B. Imposteriser
14.

The __________ package contains plugins that make it easier to use jMock with legacy code.

A. org.jmock.api
B. org.jmock.lib.action
C. org.jmock.lib.script
D. org.jmock.lib.legacy
Answer» E.