Which method in EasyMock is used to create a mock object?
A) createMock()
B) mock()
C) newMock()
D) generateMock()
Answer:
A) createMock()
Explanation:
The createMock()
method in EasyMock is used to create a mock object of a specific class or interface. This mock object can then be used in your tests to simulate the behavior of the real object.
For example:
MyService mockService = EasyMock.createMock(MyService.class);
In this example, createMock()
creates a mock object of the MyService
interface.