use of org.linkki.core.binding.BindingContextTest.TestModelObject in project linkki by linkki-framework.
the class PropertyDispatcherFactoryTest method testCreateDispatcherChain_getValueFromChangedModelObject.
@Test
public void testCreateDispatcherChain_getValueFromChangedModelObject() {
setUpPmo();
when(elementDescriptor.getModelPropertyName()).thenReturn(TestModelObject.PROPERTY_MODEL_PROP);
when(elementDescriptor.getModelObjectName()).thenReturn(ModelObject.DEFAULT_NAME);
when(elementDescriptor.getPmoPropertyName()).thenReturn("foo");
PropertyDispatcher defaultDispatcher = propertyDispatcherFactory.createDispatcherChain(pmo, elementDescriptor, PropertyBehaviorProvider.NO_BEHAVIOR_PROVIDER);
TestModelObject newModelObject = new TestModelObject();
pmo.setModelObject(newModelObject);
newModelObject.setModelProp("testNewValue");
Object modelProp = defaultDispatcher.pull(Aspect.of(""));
assertThat(modelProp, is("testNewValue"));
}
use of org.linkki.core.binding.BindingContextTest.TestModelObject in project linkki by linkki-framework.
the class PropertyDispatcherFactoryTest method testCreateDispatcherChain_setValueToChangedModelObject.
@Test
public void testCreateDispatcherChain_setValueToChangedModelObject() {
setUpPmo();
when(elementDescriptor.getModelPropertyName()).thenReturn(TestModelObject.PROPERTY_MODEL_PROP);
when(elementDescriptor.getModelObjectName()).thenReturn(ModelObject.DEFAULT_NAME);
when(elementDescriptor.getPmoPropertyName()).thenReturn("foo");
PropertyDispatcher defaultDispatcher = propertyDispatcherFactory.createDispatcherChain(pmo, elementDescriptor, PropertyBehaviorProvider.NO_BEHAVIOR_PROVIDER);
TestModelObject newModelObject = new TestModelObject();
pmo.setModelObject(newModelObject);
defaultDispatcher.push(Aspect.of("", "testNewSetValue"));
assertThat(newModelObject.getModelProp(), is("testNewSetValue"));
}
use of org.linkki.core.binding.BindingContextTest.TestModelObject in project linkki by linkki-framework.
the class PropertyDispatcherFactoryTest method setUpPmo.
private void setUpPmo() {
modelObject = new TestModelObject();
pmo.setModelObject(modelObject);
}
Aggregations