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