@Test
public void testRequiredValidationWithHiddenField() throws Exception {

	DDMForm ddmForm = new DDMForm();
	ddmForm.addDDMFormField(
		createDDMFormField("field0", "text", FieldConstants.INTEGER));
	DDMFormField field1DDMFormField = createDDMFormField(
		"field1", "text", FieldConstants.STRING);
	field1DDMFormField.setRequired(true);
	field1DDMFormField.setVisibilityExpression("field0 > 5");
	ddmForm.addDDMFormField(field1DDMFormField);
	DDMFormValues ddmFormValues = new DDMFormValues(ddmForm);
	ddmFormValues.addDDMFormFieldValue(
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field0_instanceId", "field0", new UnlocalizedValue("4")));
	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.assertNull(ddmFormFieldPropertyChanges.get("errorMessage"));
	Assert.assertNull(ddmFormFieldPropertyChanges.get("valid"));
}