DefaultDDMFormRuleActionSerializer implements SPIDDMFormRuleActionSerializer { @Override public String serialize( SPIDDMFormRuleSerializerContext spiDDMFormRuleSerializerContext) { if (Validator.isNull(_defaultDDMFormRuleAction.getTarget())) { return null; } String functionName = _actionBooleanFunctionNameMap.get( _defaultDDMFormRuleAction.getAction()); return String.format( _SET_BOOLEAN_PROPERTY_FORMAT, functionName, _defaultDDMFormRuleAction.getTarget()); } DefaultDDMFormRuleActionSerializer(
		DefaultDDMFormRuleAction defaultDDMFormRuleAction); @Override String serialize(
		SPIDDMFormRuleSerializerContext spiDDMFormRuleSerializerContext);  }
@Test public void testSerializeSetEnabled() { DefaultDDMFormRuleAction defaultDDMFormRuleAction = new DefaultDDMFormRuleAction("enable", "field0"); DefaultDDMFormRuleActionSerializer defaultDDMFormRuleActionSerializer = new DefaultDDMFormRuleActionSerializer(defaultDDMFormRuleAction); String result = defaultDDMFormRuleActionSerializer.serialize( _spiDDMFormRuleSerializerContext); Assert.assertEquals("setEnabled('field0', true)", result); }
@Test public void testSerializeSetInvalid() { DefaultDDMFormRuleAction defaultDDMFormRuleAction = new DefaultDDMFormRuleAction("invalidate", "field0"); DefaultDDMFormRuleActionSerializer defaultDDMFormRuleActionSerializer = new DefaultDDMFormRuleActionSerializer(defaultDDMFormRuleAction); String result = defaultDDMFormRuleActionSerializer.serialize( _spiDDMFormRuleSerializerContext); Assert.assertEquals("setInvalid('field0', true)", result); }
@Test public void testSerializeSetRequired() { DefaultDDMFormRuleAction defaultDDMFormRuleAction = new DefaultDDMFormRuleAction("require", "field0"); DefaultDDMFormRuleActionSerializer defaultDDMFormRuleActionSerializer = new DefaultDDMFormRuleActionSerializer(defaultDDMFormRuleAction); String result = defaultDDMFormRuleActionSerializer.serialize( _spiDDMFormRuleSerializerContext); Assert.assertEquals("setRequired('field0', true)", result); }
@Test public void testSerializeSetVisible() { DefaultDDMFormRuleAction defaultDDMFormRuleAction = new DefaultDDMFormRuleAction("show", "field0"); DefaultDDMFormRuleActionSerializer defaultDDMFormRuleActionSerializer = new DefaultDDMFormRuleActionSerializer(defaultDDMFormRuleAction); String result = defaultDDMFormRuleActionSerializer.serialize( _spiDDMFormRuleSerializerContext); Assert.assertEquals("setVisible('field0', true)", result); }