Author Login
Post Reply
Hi all,
I am quite new to jMock and I am using jMock 2.4.0.
I am testing a service class which uses a
DAO object to read and write data and
the DAO object has been mocked out.
The service has a private method which delegates
all the calls to the DAO
object. The code is like following:
public class ServiceClass {
private DAO dao;
public void aOperation(){
//some logics here
updateData(data);
}
public void anotherOperation(){
//some other logics here
updateData(data);
}
private void updateData(Data someData){
//pre processing......
dao.update(someData);
//post processing......
}
}
Now the problem is:
when I specify the Expectations should
include one call to "dao.update(someData)",
the test never passes.
The reason that the test fails is that
"expected exactly 1 time, never invoked
dao.update(someData)......".
I am wondering if I'm on the right track to write
tests for this type of methods?
Thanks in advanced!
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email