Search in sources :

Example 1 with PresentationModelAdapterFactory

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));
}
Also used : ViewGroup(android.view.ViewGroup) BindableView(org.robobinding.BindableView) BindingContext(org.robobinding.BindingContext) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) PendingAttributesForViewBuilder.aPendingAttributesForView(org.robobinding.binder.PendingAttributesForViewBuilder.aPendingAttributesForView) BindableView(org.robobinding.BindableView) PendingAttributesForView(org.robobinding.PendingAttributesForView) BindingContextFactory(org.robobinding.BindingContextFactory) ItemBinder(org.robobinding.ItemBinder) PresentationModelAdapterFactory(org.robobinding.presentationmodel.PresentationModelAdapterFactory) BinderProvider(org.robobinding.BinderProvider) InvocationOnMock(org.mockito.invocation.InvocationOnMock) JavaReflectionPresentationModelObject(org.robobinding.test.JavaReflectionPresentationModelObject)

Example 2 with PresentationModelAdapterFactory

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);
}
Also used : PresentationModelAdapterFactory(org.robobinding.presentationmodel.PresentationModelAdapterFactory) PresentationModelAdapter(org.robobinding.presentationmodel.PresentationModelAdapter)

Aggregations

PresentationModelAdapterFactory (org.robobinding.presentationmodel.PresentationModelAdapterFactory)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 BindableView (org.robobinding.BindableView)1 BinderProvider (org.robobinding.BinderProvider)1 BindingContext (org.robobinding.BindingContext)1 BindingContextFactory (org.robobinding.BindingContextFactory)1 ItemBinder (org.robobinding.ItemBinder)1 PendingAttributesForView (org.robobinding.PendingAttributesForView)1 PendingAttributesForViewBuilder.aPendingAttributesForView (org.robobinding.binder.PendingAttributesForViewBuilder.aPendingAttributesForView)1 PresentationModelAdapter (org.robobinding.presentationmodel.PresentationModelAdapter)1 JavaReflectionPresentationModelObject (org.robobinding.test.JavaReflectionPresentationModelObject)1