// =====================================================================
// Create Test Objects
// =====================================================================
final OpaqueProxyImpl simpleProxy = (OpaqueProxyImpl)
createProxy(parentProxyMock);
simpleProxy.addListener(listenerMock, false);
// =====================================================================
// Set Test Object Specific Expectations
// =====================================================================
final ProxyModelChangedEvent event = new ProxyModelChangedEvent(
simpleProxy, null, NEW_MODEL_OBJECT, true);
listenerMock.expects.proxyModelChanged(event);
parentProxyMock.expects.fireEvent(event);
parentProxyMock.expects.isReadOnly().returns(false);
parentProxyMock.expects
.setEmbeddedModelObject(simpleProxy, NEW_MODEL_OBJECT)
.returns(null);
// =====================================================================
// Test Expectations
// =====================================================================
checkModificationCountIncremented(
simpleProxy, new Modifier() {
public void modify() {
Object oldModelObject = simpleProxy.setModelObject(
NEW_MODEL_OBJECT);
assertEquals("Old model object", null, oldModelObject);
}
});
}