use of org.robobinding.presentationmodel.PresentationModelAdapterFactory in project RoboBinding by RoboBinding.
the class BindingTest method newBindingContext.
@SuppressWarnings("unchecked")
private BindingContext newBindingContext() {
BinderProvider binderProvider = mock(BinderProvider.class);
BindableView bindableView = mock(BindableView.class);
when(bindableView.getRootView()).then(new Answer<View>() {
@Override
public View answer(InvocationOnMock invocation) throws Throwable {
return new View(context);
}
});
ItemBinder itemBinder = mock(ItemBinder.class);
when(itemBinder.inflateWithoutAttachingToRoot(anyInt(), anyCollection(), any(ViewGroup.class))).thenReturn(bindableView);
when(binderProvider.createItemBinder(any(BindingContextFactory.class))).thenReturn(itemBinder);
return new BindingContext(binderProvider, context, new PresentationModelAdapterFactory().create(new JavaReflectionPresentationModelObject(new PresentationModelForTest())), PreInitializingViews.initial(true));
}
use of org.robobinding.presentationmodel.PresentationModelAdapterFactory 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);
}
Aggregations