@Test
public void testRequiredValidationWithTextField() throws Exception {

	DDMForm ddmForm = new DDMForm();
	DDMFormField ddmFormField = createDDMFormField(
		"field0", "text", FieldConstants.STRING);
	ddmFormField.setRequired(true);
	ddmForm.addDDMFormField(ddmFormField);
	DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues(
		ddmForm);
	ddmFormValues.addDDMFormFieldValue(
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field0_instanceId", "field0", new UnlocalizedValue("\n")));
	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(
		"This field is required.",
		ddmFormFieldPropertyChanges.get("errorMessage"));
	Assert.assertFalse((boolean)ddmFormFieldPropertyChanges.get("valid"));
}