@Test public void givenAPropertyViewAttributeWithTwoWayBinding_whenValueModelIsUpdated_thenViewShouldReceiveOnlyASingleUpdate() { setupAndBindAttribute(TWO_WAY_BINDING, DONT_PRE_INITIALIZE_VIEW); valueModel.setValue(A_NEW_VALUE); assertThat(attribute.viewUpdateNotificationCount, is(1)); }
@Override public void setValue(PropertyType newValue) { viewUpdatePropagationLatch.turnOn(); try { propertyValueModel.setValue(newValue); } finally { viewUpdatePropagationLatch.turnOff(); } }
@Test public void givenABoundPropertyViewAttribute_whenValueModelIsUpdated_thenNewValueShouldBePassedToThePropertyViewAttribute() { setupAndBindAttribute(ONE_WAY_BINDING, DONT_PRE_INITIALIZE_VIEW); valueModel.setValue(A_NEW_VALUE); assertThat(attribute.updatedValue, is(A_NEW_VALUE)); }