@Test
public void testToDDMFormEquals() {

	DDMForm ddmForm = DDMFormTestUtil.createDDMForm(
		SetUtil.fromArray(new Locale[] {LocaleUtil.BRAZIL, LocaleUtil.US}),
		LocaleUtil.US);
	Locale defaultLocale = ddmForm.getDefaultLocale();
	ddmForm.addDDMFormField(
		new DDMFormField() {
			{
				setIndexType("text");
				setLabel(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "label1"
						).put(
							"pt_BR", "rótulo1"
						).build(),
						defaultLocale));
				setLocalizable(true);
				setName("name1");
				setPredefinedValue(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "enter a text"
						).put(
							"pt_BR", "insira um texto"
						).build(),
						defaultLocale));
				setReadOnly(true);
				setRepeatable(true);
				setRequired(true);
				setShowLabel(true);
				setTip(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "tip1"
						).put(
							"pt_BR", "ajuda1"
						).build(),
						defaultLocale));
				setType("text");
			}
		});
	ddmForm.addDDMFormField(
		new DDMFormField() {
			{
				setIndexType("keyword");
				setLabel(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "label2"
						).put(
							"pt_BR", "rótulo2"
						).build(),
						defaultLocale));
				setName("name2");
				setLocalizable(false);
				setPredefinedValue(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "select an option"
						).put(
							"pt_BR", "selecione uma opção"
						).build(),
						defaultLocale));
				setReadOnly(false);
				setRepeatable(false);
				setRequired(false);
				setShowLabel(false);
				setTip(
					LocalizedValueUtil.toLocalizedValue(
						HashMapBuilder.<String, Object>put(
							"en_US", "tip2"
						).put(
							"pt_BR", "ajuda2"
						).build(),
						defaultLocale));
				setType("select");
			}
		});
	Assert.assertEquals(
		ddmForm,
		DataDefinitionUtil.toDDMForm(
			new DataDefinition() {
				{
					setAvailableLanguageIds(
						new String[] {"en_US", "pt_BR"});
					setDataDefinitionFields(
						new DataDefinitionField[] {
							new DataDefinitionField() {
								{
									setDefaultValue(
										HashMapBuilder.<String, Object>put(
											"en_US", "enter a text"
										).put(
											"pt_BR", "insira um texto"
										).build());
									setFieldType("text");
									setIndexType(IndexType.TEXT);
									setLabel(
										HashMapBuilder.<String, Object>put(
											"en_US", "label1"
										).put(
											"pt_BR", "rótulo1"
										).build());
									setLocalizable(true);
									setName("name1");
									setReadOnly(true);
									setRepeatable(true);
									setRequired(true);
									setShowLabel(true);
									setTip(
										HashMapBuilder.<String, Object>put(
											"en_US", "tip1"
										).put(
											"pt_BR", "ajuda1"
										).build());
								}
							},
							new DataDefinitionField() {
								{
									setDefaultValue(
										HashMapBuilder.<String, Object>put(
											"en_US", "select an option"
										).put(
											"pt_BR", "selecione uma opção"
										).build());
									setFieldType("select");
									setIndexType(IndexType.KEYWORD);
									setLabel(
										HashMapBuilder.<String, Object>put(
											"en_US", "label2"
										).put(
											"pt_BR", "rótulo2"
										).build());
									setName("name2");
									setLocalizable(false);
									setReadOnly(false);
									setRepeatable(false);
									setRequired(false);
									setShowLabel(false);
									setTip(
										HashMapBuilder.<String, Object>put(
											"en_US", "tip2"
										).put(
											"pt_BR", "ajuda2"
										).build());
								}
							}
						});
					setDefaultLanguageId("en_US");
				}
			},
			_ddmFormFieldTypeServicesTracker));
}