Search in sources :

Example 1 with JavaReflectionPresentationModelObject

use of org.robobinding.test.JavaReflectionPresentationModelObject 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)

Aggregations

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 PresentationModelAdapterFactory (org.robobinding.presentationmodel.PresentationModelAdapterFactory)1 JavaReflectionPresentationModelObject (org.robobinding.test.JavaReflectionPresentationModelObject)1