*/
public void testRelease() throws Exception {
TestRecoverableResourceOwnerStack trros =
new TestRecoverableResourceOwnerStack();
final ResourceOwnerMock resourceOwnerMock =
new ResourceOwnerMock("resourceOwnerMock", expectations);
trros.push(resourceOwnerMock, false);
final ResourceOwnerMock releasableMock =
new ResourceOwnerMock("releasableMock", expectations);
trros.push(releasableMock, true);
final ResourceOwnerMock unnestedMock =
new ResourceOwnerMock("unnestedMock", expectations);
trros.startTransaction();
trros.push(unnestedMock, true);
Object pushedObject = trros.pushedResourceOwners.peek();
assertSame("Expected object on pushed stack.", unnestedMock,
((ReleasableResourceOwner) pushedObject).getResourceOwner());
// Nest another transaction
final ResourceOwnerMock nestedMock =
new ResourceOwnerMock("nestedMock", expectations);
trros.startTransaction();
trros.push(nestedMock, true);
pushedObject = trros.pushedResourceOwners.peek();
assertSame("Expected object on pushed stack.", nestedMock,
((ReleasableResourceOwner) pushedObject).getResourceOwner());