@Test
public void testRequiredValidationWithinRuleAction() throws Exception {

	DDMForm ddmForm = new DDMForm();
	DDMFormField ddmFormField0 = createDDMFormField(
		"field0", "text", FieldConstants.NUMBER);
	DDMFormField ddmFormField1 = createDDMFormField(
		"field1", "text", FieldConstants.STRING);
	ddmForm.addDDMFormField(ddmFormField0);
	ddmForm.addDDMFormField(ddmFormField1);
	ddmForm.addDDMFormRule(
		new DDMFormRule(
			Arrays.asList("setRequired(\"field1\", true)"),
			"getValue(\"field0\") > 10"));
	DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues(
		ddmForm);
	ddmFormValues.addDDMFormFieldValue(
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field0_instanceId", "field0", new UnlocalizedValue("11")));
	ddmFormValues.addDDMFormFieldValue(
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field1_instanceId", "field1", new UnlocalizedValue("")));
	DDMFormEvaluatorEvaluateResponse ddmFormEvaluatorEvaluateResponse =
		doEvaluate(ddmForm, ddmFormValues);
	Map<DDMFormEvaluatorFieldContextKey, Map<String, Object>>
		ddmFormFieldsPropertyChanges =
			ddmFormEvaluatorEvaluateResponse.
				getDDMFormFieldsPropertyChanges();
	Assert.assertEquals(
		ddmFormFieldsPropertyChanges.toString(), 1,
		ddmFormFieldsPropertyChanges.size());
	Map<String, Object> ddmFormFieldPropertyChanges =
		ddmFormFieldsPropertyChanges.get(
			new DDMFormEvaluatorFieldContextKey(
				"field1", "field1_instanceId"));
	Assert.assertEquals(
		"This field is required.",
		ddmFormFieldPropertyChanges.get("errorMessage"));
	Assert.assertFalse((boolean)ddmFormFieldPropertyChanges.get("valid"));
}