use of org.linkki.core.binding.dispatcher.PropertyDispatcher in project linkki by linkki-framework.
the class PropertyDispatcherFactoryTest method testCreateDispatcherChain_pushToPmo.
@Test
public void testCreateDispatcherChain_pushToPmo() {
setUpPmo();
when(elementDescriptor.getModelPropertyName()).thenReturn("foo");
when(elementDescriptor.getModelObjectName()).thenReturn(ModelObject.DEFAULT_NAME);
when(elementDescriptor.getPmoPropertyName()).thenReturn("value");
PropertyDispatcher defaultDispatcher = propertyDispatcherFactory.createDispatcherChain(pmo, elementDescriptor, PropertyBehaviorProvider.NO_BEHAVIOR_PROVIDER);
defaultDispatcher.push(Aspect.of("", ANY_VALUE));
assertThat(pmo.getValue(), is(ANY_VALUE));
}
use of org.linkki.core.binding.dispatcher.PropertyDispatcher 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.dispatcher.PropertyDispatcher 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.dispatcher.PropertyDispatcher in project linkki by linkki-framework.
the class BindAnnotationDescriptorTest method testCreateBinding_CreatesLabelBindingForLabel.
@Test
public void testCreateBinding_CreatesLabelBindingForLabel() {
BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new Label()));
assertThat(binding, is(instanceOf(ElementBinding.class)));
}
use of org.linkki.core.binding.dispatcher.PropertyDispatcher in project linkki by linkki-framework.
the class BindAnnotationDescriptorTest method testCreateBinding_CreatesButtonBindingForButton.
@Test
public void testCreateBinding_CreatesButtonBindingForButton() {
BindAnnotationDescriptor descriptor = new BindAnnotationDescriptor(mock(Bind.class), new ArrayList<>());
PropertyDispatcher dispatcher = mock(PropertyDispatcher.class);
ElementBinding binding = descriptor.createBinding(dispatcher, Handler.NOP_HANDLER, new LabelComponentWrapper(new Button()));
assertThat(binding, is(instanceOf(ElementBinding.class)));
}
Aggregations