Which EasyMock method is used to create a strict mock object?

Which EasyMock method is used to create a strict mock object?

A) createStrictMock()
B) createMock()
C) mockStrictly()
D) strictMock()

Answer:

A) createStrictMock()

Explanation:

The createStrictMock() method in EasyMock is used to create a strict mock object. A strict mock ensures that the methods are called in the exact order in which they were expected. If the methods are called out of order, the test will fail.

For example:


MyService strictMockService = EasyMock.createStrictMock(MyService.class);

In this example, createStrictMock() creates a strict mock of the MyService interface, where the order of method calls is enforced.

Reference links:

https://www.javaguides.net/p/top-java-libraries.html

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top