If I have the following method:
public void handleUser(String user) { User user = new User("Bob"); Phone phone = userDao.getPhone(user);
When I test this with mocks using EasyMock, is there anyway, I can check the User parameter that I passed to my UserDao code as follows:
User user = new User("Bob"); EasyMock.expect(userDaoMock.getPhone(user)).andReturn(new Phone());
When I tried to run the above test, it complains about an unexpected method call, which I assume, because the actual user created in the method does not match the one I pass in ... Am I right about that?
Or the most stringent way to check the parameter I pass to UserDao:
EasyMock.expect(userDaoMock.getPhone(EasyMock.isA(User.class))).andReturn(new Phone());
Glide source share