@Test
public void testTextField() {

	// Dynamic data mapping form
	DDMForm ddmForm = DDMFormTestUtil.createDDMForm();
	boolean required = true;
	DDMFormField ddmFormField = DDMFormTestUtil.createTextDDMFormField(
		"Field1", false, false, required);
	ddmFormField.setLabel(
		DDMFormValuesTestUtil.createLocalizedValue("Field 1", _LOCALE));
	ddmFormField.setReadOnly(false);
	ddmFormField.setTip(
		DDMFormValuesTestUtil.createLocalizedValue(
			"This is a tip.", _LOCALE));
	ddmFormField.setProperty("displayStyle", "singleline");
	ddmForm.addDDMFormField(ddmFormField);
	// Dynamic data mapping form field evaluation
	String instanceId = StringUtil.randomString();
	Map<DDMFormEvaluatorFieldContextKey, Map<String, Object>>
		ddmFormFieldsPropertyChanges =
			HashMapBuilder.
				<DDMFormEvaluatorFieldContextKey, Map<String, Object>>put(
					new DDMFormEvaluatorFieldContextKey(
						"Field1", instanceId),
					HashMapBuilder.<String, Object>put(
						"required", true
					).put(
						"valid", true
					).put(
						"visible", true
					).build()
				).build();
	// Dynamic data mapping form values
	List<DDMFormFieldValue> ddmFormFieldValues = new ArrayList<>();
	DDMFormFieldValue ddmFormFieldValue =
		DDMFormValuesTestUtil.createUnlocalizedDDMFormFieldValue(
			"Field1", "Value 1");
	ddmFormFieldValue.setInstanceId(instanceId);
	ddmFormFieldValues.add(ddmFormFieldValue);
	DDMFormFieldTemplateContextFactory ddmFormFieldTemplateContextFactory =
		createDDMFormFieldTemplateContextFactory(
			ddmForm, ddmFormField.getName(), ddmFormFieldsPropertyChanges,
			ddmFormFieldValues, false, getTextDDMFormFieldRenderer(),
			getTextDDMFormFieldTemplateContextContributor());
	List<Object> fields = ddmFormFieldTemplateContextFactory.create();
	Assert.assertEquals(fields.toString(), 1, fields.size());
	Map<String, Object> fieldTemplateContext =
		(Map<String, Object>)fields.get(0);
	Assert.assertEquals(
		"singleline",
		MapUtil.getString(fieldTemplateContext, "displayStyle"));
	Assert.assertEquals(
		"Field 1", MapUtil.getString(fieldTemplateContext, "label"));
	Assert.assertEquals(
		false, MapUtil.getBoolean(fieldTemplateContext, "readOnly"));
	Assert.assertEquals(
		false, MapUtil.getBoolean(fieldTemplateContext, "repeatable"));
	Assert.assertEquals(
		true, MapUtil.getBoolean(fieldTemplateContext, "required"));
	Assert.assertEquals(
		"This is a tip.", MapUtil.getString(fieldTemplateContext, "tip"));
	Assert.assertEquals(
		true, MapUtil.getBoolean(fieldTemplateContext, "valid"));
	Assert.assertEquals(
		StringPool.BLANK,
		MapUtil.getString(fieldTemplateContext, "validationErrorMessage"));
	Assert.assertEquals(
		"Value 1", MapUtil.getString(fieldTemplateContext, "value"));
	Assert.assertEquals(
		true, MapUtil.getBoolean(fieldTemplateContext, "visible"));
	String expectedName = String.format(
		_FIELD_NAME_FORMAT, "Field1", instanceId, 0, _LOCALE.toString());
	Assert.assertEquals(
		expectedName, MapUtil.getString(fieldTemplateContext, "name"));
}