rmock mock object only returns default value
rMock with JUnit 3.81 and Java 1.4.2
I have a implemented method of an interface that changes the ACL of an
object in a document management system:
void changeACL(String docbase, IDfSysObject reference, String
aclDomain, String aclName) throws DfServiceException
I have a test method:
public final void testChangeACL() {
/* Set up Mock objects */
IDfSysObject mockObj = (IDfSysObject) mock(IDfSysObject.class);
IDoctypeSBO sbo = (IDoctypeSBO) mock(IDoctypeSBO.class);
/* Expectations */
try {
sbo.changeACL("docbasename", mockObj, "newdomain", "newacl");
mockObj.getACLName();
mockObj.getACLDomain();
} catch (DfException dfe) {
}
/* Verification */
startVerification();
try {
sbo.changeACL("docbasename", mockObj, "newdomain", "newacl");
assertThat(mockObj.getACLName(), is.eq("newacl"));
assertThat(mockObj.getACLDomain(), is.eq("newdomain"));
} catch (DfException dfe) {
}
}
The problem is that the assertions fail with:
com.agical.rmock.core.exception.RMockAssertionFailedException:
ASSERTION FAILED!
<null>
does not pass the expression:
<eq(<newacl>)>
....
I think this is because mockObj.getACLName() is returning null because
it is not affected by the changeACL method. How can I make the
changeACL method have an affect, i.e. change attributes of the mocked
object?
thanks,
-Mark