I have am having a problem with EasyMock returning null for an expected (defined) method call.
Creation of the mocked Object
mock = EasyMock.createMock(DAO.class);
Mock Set up in unit test.
expect(mock.update(myObj).andReturn(myObjUpdated).once();
replayAll();
service.setDao(mock);
service.processData(myObj);
verifyAll();
processData method simply calls
MyObject objUpdated = dao.update(myObj);
here is the interface that the mock is being built from.
public interface DAO {
public <ENTITY> ENTITY update(ENTITY entity);
}
I am pretty confused by what might be causing the problem. I have confirmed that 'obj' is the same object as I defined in the unit test. I have also not experienced this problem (that I am aware of) with any other methods that mocked.
Could the problem possibly be with the Object that is being passed in?
Thanks in advance. I am really not sure what other information might be helpful to you here.
edit: this is the test class (and as it turns out where my misunderstanding began)
public class TestMyService extends EasyMockHelper {...}