[testbox-1.1.0] Error in calling mocked object method

I am running the latest version of TestBox on a CF 10 server and I have one test case failing out of close to 100 tests. In this test suite / test case, I have the following mocked objects defined:

var PasswordResetMock = createEmptyMock( ‘com.system.security.PasswordReset’ );

var SecurityDAOMock = createEmptyMock( ‘com.system.security.SecurityDAO’ );

SecurityDAOMock.$( ‘getPasswordReset’, PasswordResetMock );

SecurityDAOMock.$( ‘savePasswordReset’, PasswordResetMock );

SecurityService.setSecurityDAO( SecurityDAOMock );

var result = SecurityService.changePassword( ‘goodToken’, ‘Password1’ );

Now, in the changePassword function on the SecurityService object, the code looks like this:

var PasswordReset = SecurityDAO.getPasswordReset( resetToken = arguments.resetToken )
SecurityDAO.savePasswordReset( PasswordReset );

The first line runs without issue. On the second line, the server just spins until I get a java heap space error and then crashes.

All of the other test cases in this test suite and several other test suites work just fine, many of them using mocked objects including this SecurityDAO mock. The live code works without error as well. But I cannot figure out what is causing this one test case to crash the server.

Any ideas what I am missing or where I can look?

Thanks,
– Jeff

This appears to be being caused by a circular loop of some sort. On the business objects in this system, a setter method returns a pointer back to the business object so that methods can be chained together.

For example, in the above code, I have the following two lines after the PasswordResetMock object creation:

var PasswordResetMock = createEmptyMock( ‘com.system.security.PasswordReset’ );
PasswordResetMock.$( ‘setIsActive’, PasswordResetMock );
PasswordResetMock.$( ‘setIPClicked’, PasswordResetMock );

If I remove one of the mocked method references, then this test runs without issue. However, when I have two mocked methods like this which both return a reference to the mocked object, the server crashes. It does not matter which method is being mocked - just the fact that two (or more) methods are being mocked.

Also, it does not appear to make a difference if I use ‘createEmptyMock’ or ‘createMock’.

Any ideas what is going on here and why I can’t do this?

Thanks,
– Jeff