Search in sources :

Example 1 with TestModelObject

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"));
}
Also used : TestModelObject(org.linkki.core.binding.BindingContextTest.TestModelObject) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) ModelObject(org.linkki.core.ui.section.annotations.ModelObject) TestModelObject(org.linkki.core.binding.BindingContextTest.TestModelObject) Test(org.junit.Test)

Example 2 with TestModelObject

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"));
}
Also used : TestModelObject(org.linkki.core.binding.BindingContextTest.TestModelObject) PropertyDispatcher(org.linkki.core.binding.dispatcher.PropertyDispatcher) Test(org.junit.Test)

Example 3 with TestModelObject

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);
}
Also used : TestModelObject(org.linkki.core.binding.BindingContextTest.TestModelObject)

Aggregations

TestModelObject (org.linkki.core.binding.BindingContextTest.TestModelObject)3 Test (org.junit.Test)2 PropertyDispatcher (org.linkki.core.binding.dispatcher.PropertyDispatcher)2 ModelObject (org.linkki.core.ui.section.annotations.ModelObject)1