If I have the following method:
public void handleUser(String user) {
User user = new User("Bob");
Phone phone = userDao.getPhone(user);
//something else
}
When I'm testing this with mocks using EasyMock, is there anyway I could test the User parameter I passing into my UserDao mock like this:
User user = new User("Bob");
EasyMock.expect(userDaoMock.getPhone(user)).andReturn(new Phone());
When I tried to run the above test, it complains about unexpected method call which I assume because the actualy User created in the method is not the same as the one I'm passing in...am I correct about that?
Or is the strictest way I could test the parameter I'm passing into UserDao is just:
EasyMock.expect(userDaoMock.getPhone(EasyMock.isA(User.class))).andReturn(new Phone());