I am having trouble returning EasyMock null for the expected (specific) method call.
Create a mocking object
mock = EasyMock.createMock(DAO.class);
Layout Install in unit test.
expect(mock.update(myObj).andReturn(myObjUpdated).once(); replayAll(); service.setDao(mock); service.processData(myObj); verifyAll();
The processData method simply calls
MyObject objUpdated = dao.update(myObj);
here is the interface from which the layout is built.
public interface DAO { public <ENTITY> ENTITY update(ENTITY entity); }
I'm pretty confused about what might cause the problem. I confirmed that "obj" is the same object that I defined in unit test. I also did not experience this problem (what I know) with any other methods that were taunted.
Could the problem be with the object that is being passed in?
Thanks in advance. I'm really not sure what other information might be useful to you here.
edit: this is a test class (and, as it turns out, where did my misunderstanding begin)
public class TestMyService extends EasyMockHelper {...}
source share