Olete.in
Articles
Mock Tests
🧪 ANT MCQ Quiz Hub
ANT Mcq
Choose a topic to test your knowledge and improve your ANT skills
1. Mocks are Trojan horses because they replace real ___________ from the inside, without the calling classes being aware of it.
Methods
Objects
Variables
Classes
2. When we’re talking about mock objects, a/an _________ is a feature built into the mock that verifies whether the external class calling this mock has the correct behavior.
Expectation
Explanation
Behavior
Amorous
3. EasyMock relies heavily on the __________import feature of Java.
Dynamic
Static
Class
Object
4. To use the createMock method of EasyMock we need to import ___________
org.easymock.EasyMock.createMock
org.EasyMock.createMock
org.easymock.createMock
org.createMock
5. __________ method creates a mock object that implements the given interface, order checking is enabled by default.
createNiceControl
createMockBuilder
createNiceMock
createStrictMock
6. __________ is used for the creation of a mock object, with the specification of it being of the requested type, which has implementations of the given interface or extends the given class.
createMock(Class<T> toMock)
createMock(MockType type, Class<T> toMock)
createMock(String name, Class<T>toMock)
createMock(String name, MockType type, Class<T>toMock)
7. __________________ creates a mock object, of the requested type and name which are passed, which also has implementations of the given interface or extends the given class.
createMock(Class <T> toMock)
createMock(MockType type, Class<T> toMock)
createMock(String name, Class<T> toMock)
createMock(String name, MockType type, Class<T> toMock)
8. _____________ creates a mock object that implements the given interface with the specification is that order checking is disabled by default.
createMock(Class<T> toMock)
createMock(MockType type, Class<T>toMock)
createMock(String name, Class<T> toMock)
createMock(String name, MockType type, Class<T> toMock)
9. createMock(String name, Class<T> toMock) throws _________________ exception.
IndexOutOfBounds
IllegalArgumentException
NullPointer
Arithmetic
10. ________________ creates a mock builder allowing to create a partial mock for the given class or interface.
createMockBuilder(Class&lt;T&gt; toMock)
createMock(Class&lt;T&gt; toMock)
createNiceControl()
createNiceMock(Class&lt;T&gt; toMock)
11. 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>
IMockBuilder&lt;T&gt;
IMocker&lt;T&gt;
IBuilder&lt;T&gt;expect(T value)
MockBuilder&lt;T&gt;
12. ____________ creates a control of the requested type.
createControl()
createControl(MockType type)
createNiceControl()
createNiceMock(Class&lt;T&gt; toMock)
13. _____________ returns the expectation setter for the last expected invocation in the current thread.
createControl()
createControl(MockType type)
createNiceControl()
expect(T value)
14. The _______________ interface decides whether an actual argument is accepted.
IMockBuilder&lt;T&gt;
IMocker&lt;T&gt;
IBuilder&lt;T&gt;expect(T value)
IArgumentMatcher
15. . The __________ interface allows setting expectations for an associated expected invocation.
IMocksControl
IExpectationSetters&lt;T&gt;
IExpectation&lt;T&gt;
Isetters&lt;T&gt;
16. ____________ function expect the last invocation any times.
andStubReturn(T value)
andThrow(Throwable throwable)
anyTimes()
asStub()
17. _____________ sets stub behavior for the expected invocation.
andStubReturn(T value)
andThrow(Throwable throwable)
anyTimes()
asStub()
18. _______________ expect the last invocation between min and max times.
times(int count)
times(int min, int max)
once()
asStub()
19. 5. ____________ expect the last invocation a specified number of times.
times(int count)
times(int min, int max)
once()
asStub()
20. _____________ sets a stub object that will be used for the calculation of the answer for the expected invocation.
andAnswer(IAnswer&lt;? extends T&gt;answer)
andDelegateTo(Object delegateTo)
andStubAnswer(IAnswer&lt;? extends T&gt; answer)
andThrow(Throwable throwable)
21. _______________ sets a stub object implementing the same interface as the mock.
andAnswer(IAnswer&lt;? extends T&gt; answer)
andDelegateTo(Object delegateTo)
andStubAnswer(IAnswer&lt;? extends T&gt; answer)
andStubDelegateTo(Object delegateTo)
22. ____________ records a call but returns nothing.
andVoid()
times(int min, int max)
once()
asStub()
23. _____________ expects the last invocation once.
andVoid()
times(int min, int max)
once()
asStub()
24. ______________ sets a return value that will be returned for the expected invocation.
andReturn(T value)
times(int min, int max)
once()
asStub()
Submit