@Test
public void testValidationRule() throws Exception {

	DDMForm ddmForm = new DDMForm();
	ddmForm.addDDMFormField(
		createDDMFormField("field0", "numeric", FieldConstants.DOUBLE));
	ddmForm.addDDMFormRule(
		new DDMFormRule(
			Arrays.asList(
				"setInvalid(" +
					"\"field0\", \"The value should be greater than " +
						"10.\")"),
			"getValue(\"field0\") <= 10"));
	DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues(
		ddmForm);
	ddmFormValues.addDDMFormFieldValue(
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field0_instanceId", "field0", new UnlocalizedValue("5")));
	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(
				"field0", "field0_instanceId"));
	Assert.assertEquals(
		"The value should be greater than 10.",
		ddmFormFieldPropertyChanges.get("errorMessage"));
	Assert.assertFalse((boolean)ddmFormFieldPropertyChanges.get("valid"));
}