Explore topic-wise MCQs in Junit.

This section includes 13 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 _______________ interface decides whether an actual argument is accepted.

A. IMockBuilder<T>
B. IMocker<T>
C. IBuilder<T>expect(T value)
D. IArgumentMatcher
E. IArgumentMatcher
Answer» E. IArgumentMatcher
2.

_____________ reports an argument matcher.

A. newCapture()
B. makeThreadSafe()
C. reportMatcher(IArgumentMatcher matcher)
D. createNiceMock(Class<T> toMock)
Answer» D. createNiceMock(Class<T> toMock)
3.

______________ create a new capture instance that will keep only the last captured value.

A. newCapture()
B. makeThreadSafe()
C. createNiceControl()
D. createNiceMock(Class<T> toMock)
Answer» B. makeThreadSafe()
4.

______________REPORTS_AN_ARGUMENT_MATCHER.?$

A. newCapture()
B. makeThreadSafe()
C. reportMatcher(IArgumentMatcher matcher)
D. createNiceMock(Class<T> toMock)
Answer» D. createNiceMock(Class<T> toMock)
5.

The_________________interface_decides_whether_an_actual_argument_is_accepted.$

A. IMockBuilder<T>
B. IMocker<T>
C. IBuilder<T>expect(T value)
D. IArgumentMatcher
Answer» E.
6.

______________ create a new capture instance that will keep only the last captured value?

A. newCapture()
B. makeThreadSafe()
C. createNiceControl()
D. createNiceMock(Class<T> toMock)
Answer» B. makeThreadSafe()
7.

By default, a mock is thread safe.

A. True
B. False
Answer» B. False
8.

_____________ expects a comparable argument greater than or equal the given value.

A. anyObject()
B. anyString()
C. geq(Comparable<T> value)
D. anyDouble()
Answer» D. anyDouble()
9.

anyObject() expects any double argument.

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

_____________ returns the expectation setter for the last expected invocation in the current thread.

A. createControl()
B. createControl(MockType type)
C. createNiceControl()
D. expect(T value)
Answer» E.
11.

____________ creates a control of the requested type.

A. createControl()
B. createControl(MockType type)
C. createNiceControl()
D. createNiceMock(Class<T> toMock)
Answer» C. createNiceControl()
12.

The ____________ interface is used in the creation of partial mocks with EasyMock.

A. IMockBuilder<T>
B. IMocker<T>
C. IBuilder<T>expect(T value)
D. MockBuilder<T>
Answer» B. IMocker<T>
13.

________________ creates a mock builder allowing to create a partial mock for the given class or interface.

A. createMockBuilder(Class<T> toMock)
B. createMock(Class<T> toMock)
C. createNiceControl()
D. createNiceMock(Class<T> toMock)
Answer» B. createMock(Class<T> toMock)