rmock mock object only returns default value

M

mfaine

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top