Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > rmock mock object only returns default value

Thread Tools

rmock mock object only returns default value

Posts: n/a
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");
} catch (DfException dfe) {

/* Verification */
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.RMockAssertionFail edException:
does not pass the expression:

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


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need recommendations on mock object packages Matthew Wilson Python 1 10-18-2007 03:36 AM
Is this Mock Object Approach too complex? Ken Java 0 07-16-2004 03:57 AM
"Virtual" file system mock object - replacing stuff in __builtins__ Remy Blank Python 3 03-06-2004 12:20 AM
problem with closure arguments and *args in mock object John J. Lee Python 4 11-08-2003 12:28 PM
Mock object creation by example? John J. Lee Python 0 07-08-2003 11:27 PM