Search in sources :

Example 1 with PresentationModelAdapter

use of org.robobinding.presentationmodel.PresentationModelAdapter in project RoboBinding by RoboBinding.

the class BindingContextTest method shouldItemBindingContextWithExpectedPreInitializeViews.

@Test
public void shouldItemBindingContextWithExpectedPreInitializeViews() {
    boolean expectedPreInitializeViews = RandomValues.trueOrFalse();
    String propertyName = "pName";
    DataSetValueModel dataSetProperty = mock(DataSetValueModel.class);
    when(dataSetProperty.preInitializingViewsWithDefault(anyBoolean())).thenReturn(expectedPreInitializeViews);
    PresentationModelAdapter presentationModelAdapter = aPresentationModelAdapterWithDataSetProperty(propertyName, dataSetProperty);
    BindingContext context = newBindingContext(presentationModelAdapter);
    ItemBindingContext itemBindingContext = context.navigateToItemContext(propertyName);
    assertThat(itemBindingContext.shouldPreInitializeViews(), is(expectedPreInitializeViews));
}
Also used : DataSetValueModel(org.robobinding.property.DataSetValueModel) PresentationModelAdapter(org.robobinding.presentationmodel.PresentationModelAdapter) Test(org.junit.Test)

Example 2 with PresentationModelAdapter

use of org.robobinding.presentationmodel.PresentationModelAdapter in project RoboBinding by RoboBinding.

the class PresentationModelTester method spyPropertyChange.

public static PresentationModelPropertyChangeSpy spyPropertyChange(Object presentationModel, String propertyName) {
    Preconditions.checkNotNull(presentationModel, "presentationModel must not be null");
    checkNotBlank(propertyName, "propertyName must not be empty");
    PresentationModelAdapter presentationModelAdapter = new PresentationModelAdapterFactory().create(new JavaReflectionPresentationModelObject(presentationModel));
    PresentationModelTester presentationModelTester = new PresentationModelTester(presentationModelAdapter);
    return presentationModelTester.spyPropertyChange(propertyName);
}
Also used : PresentationModelAdapterFactory(org.robobinding.presentationmodel.PresentationModelAdapterFactory) PresentationModelAdapter(org.robobinding.presentationmodel.PresentationModelAdapter)

Aggregations

PresentationModelAdapter (org.robobinding.presentationmodel.PresentationModelAdapter)2 Test (org.junit.Test)1 PresentationModelAdapterFactory (org.robobinding.presentationmodel.PresentationModelAdapterFactory)1 DataSetValueModel (org.robobinding.property.DataSetValueModel)1