EasyMock is an alternative mocking framework. It is very similar to Mockito. However, the main difference is that EasyMock does not create spy objects but mocks. Other differences are syntactical.
Let's see an example of EasyMock. We'll use the same set of test cases as those that were used for the Mockito examples:
@RunWith(EasyMockRunner.class) public class FriendshipsTest { @TestSubject FriendshipsMongo friendships = new FriendshipsMongo(); @Mock(type = MockType.NICE) FriendsCollection friends;}
Essentially, the runner does the same as the Mockito runner:
@TestSubject FriendshipsMongo friendships = new FriendshipsMongo(); @Mock(type = MockType.NICE) FriendsCollection friends;
The @TestSubject annotation is similar to Mockito's ...