private BindingContext bindingContextOfThrowingExceptionWhenRetrievingPropertyValueModel() { when(bindingContext.getPropertyValueModel(anyString())).thenThrow(new RuntimeException()); when(bindingContext.getReadOnlyPropertyValueModel(anyString())) .thenThrow(new RuntimeException()); when(bindingContext.getDataSetPropertyValueModel(anyString())) .thenThrow(new RuntimeException()); return bindingContext; }
private void bindAttribute(boolean twoWayBinding, boolean preInitializeView) { if (twoWayBinding) when(bindingContext.<Integer>getPropertyValueModel(PROPERTY_NAME)).thenReturn(valueModel); else when(bindingContext.<Integer>getReadOnlyPropertyValueModel(PROPERTY_NAME)) .thenReturn(valueModel); when(bindingContext.shouldPreInitializeViews()).thenReturn(preInitializeView); if (preInitializeView) { attribute.preInitializeView(bindingContext); } attribute.bindTo(bindingContext); }
@Override public void bindTo(BindingContext bindingContext) { SubViewBinder viewBinder = bindingContext.createSubViewBinder(); View subView = viewBinder.inflateAndBind(layoutId, attribute.getPropertyName()); subViewHolder.setSubView(subView); }