SetPropertyFunction implements DDMExpressionFunction.Function2<String, V, Boolean>,
			   DDMExpressionObserverAware { @Override public Boolean apply(String field, V value) { if (_ddmExpressionObserver == null) { return false; } UpdateFieldPropertyRequest.Builder builder = UpdateFieldPropertyRequest.Builder.newBuilder( field, getPropertyName(), value); _ddmExpressionObserver.updateFieldProperty(builder.build()); return true; }  @Override Boolean apply(String field, V value); @Override void setDDMExpressionObserver(
		DDMExpressionObserver ddmExpressionObserver);  }
@Test public void testApply() { SetPropertyFunction<Boolean> setPropertyFunction = new SetMultipleFunction(); DefaultDDMExpressionObserver defaultDDMExpressionObserver = new DefaultDDMExpressionObserver(); DefaultDDMExpressionObserver spy = spy(defaultDDMExpressionObserver); setPropertyFunction.setDDMExpressionObserver(spy); Boolean result = setPropertyFunction.apply("field", true); ArgumentCaptor<UpdateFieldPropertyRequest> argumentCaptor = ArgumentCaptor.forClass(UpdateFieldPropertyRequest.class); Mockito.verify( spy, Mockito.times(1) ).updateFieldProperty( argumentCaptor.capture() ); Assert.assertTrue(result); UpdateFieldPropertyRequest updateFieldPropertyRequest = argumentCaptor.getValue(); Map<String, Object> properties = updateFieldPropertyRequest.getProperties(); Assert.assertEquals("field", updateFieldPropertyRequest.getField()); Assert.assertTrue(properties.containsKey("multiple")); Assert.assertTrue((boolean)properties.get("multiple")); }
@Test public void testNullObserver() { SetPropertyFunction<Boolean> setPropertyFunction = new SetEnabledFunction(); Assert.assertFalse(setPropertyFunction.apply("field", true)); }