@Test
public void testGetDDMFormFieldValues() throws Exception {

	DDMFormInstanceRecordExporterImpl ddmFormInstanceRecordExporterImpl =
		mock(DDMFormInstanceRecordExporterImpl.class);
	Locale locale = new Locale("pt", "BR");
	List<DDMFormInstanceRecord> ddmFormInstanceRecords = new ArrayList<>();
	DDMFormInstanceRecord ddmFormInstanceRecord = mock(
		DDMFormInstanceRecord.class);
	ddmFormInstanceRecords.add(ddmFormInstanceRecord);
	DDMForm ddmForm = DDMFormTestUtil.createDDMForm();
	DDMFormField ddmFormField1 = new DDMFormField("field1", "text");
	ddmForm.addDDMFormField(ddmFormField1);
	DDMFormField ddmFormField2 = new DDMFormField("field2", "text");
	ddmForm.addDDMFormField(ddmFormField2);
	Map<String, DDMFormField> ddmFormFields =
		HashMapBuilder.<String, DDMFormField>put(
			"field1", ddmFormField1
		).put(
			"field2", ddmFormField2
		).build();
	DDMFormValues ddmFormValues1 =
		DDMFormValuesTestUtil.createDDMFormValues(ddmForm);
	DDMFormFieldValue ddmFormFieldValue2 =
		DDMFormValuesTestUtil.createDDMFormFieldValue(
			"field2", new UnlocalizedValue("value2"));
	ddmFormValues1.addDDMFormFieldValue(ddmFormFieldValue2);
	DDMFormInstanceRecordVersion ddmFormInstanceRecordVersion = mock(
		DDMFormInstanceRecordVersion.class);
	when(
		ddmFormInstanceRecord.getDDMFormValues()
	).thenReturn(
		ddmFormValues1
	);
	when(
		ddmFormInstanceRecordExporterImpl.getDDMFormFieldValue(
			Matchers.any(DDMFormField.class), Matchers.anyMap(),
			Matchers.any(Locale.class))
	).thenReturn(
		"value"
	);
	when(
		ddmFormInstanceRecord.getFormInstanceRecordVersion()
	).thenReturn(
		ddmFormInstanceRecordVersion
	);
	when(
		ddmFormInstanceRecordVersion.getStatus()
	).thenReturn(
		WorkflowConstants.STATUS_APPROVED
	);
	Date statusDate = new Date();
	when(
		ddmFormInstanceRecordVersion.getStatusDate()
	).thenReturn(
		statusDate
	);
	when(
		ddmFormInstanceRecordVersion.getUserName()
	).thenReturn(
		"User Name"
	);
	when(
		ddmFormInstanceRecordExporterImpl.getStatusMessage(
			Matchers.anyInt(), Matchers.any(Locale.class))
	).thenReturn(
		"aprovado"
	);
	when(
		ddmFormInstanceRecordExporterImpl.getDDMFormFieldValues(
			ddmFormFields, ddmFormInstanceRecords, locale)
	).thenCallRealMethod();
	List<Map<String, String>> ddmFormFieldValues =
		ddmFormInstanceRecordExporterImpl.getDDMFormFieldValues(
			ddmFormFields, ddmFormInstanceRecords, locale);
	Map<String, String> valuesMap = ddmFormFieldValues.get(0);
	Assert.assertEquals("User Name", valuesMap.get("author"));
	Assert.assertEquals(StringPool.BLANK, valuesMap.get("field1"));
	Assert.assertEquals("value", valuesMap.get("field2"));
	Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(
		locale);
	String modifiedDate = dateFormatDateTime.format(statusDate);
	Assert.assertEquals(modifiedDate, valuesMap.get("modifiedDate"));
	Assert.assertEquals("aprovado", valuesMap.get("status"));
	InOrder inOrder = Mockito.inOrder(
		ddmFormInstanceRecordExporterImpl, ddmFormInstanceRecord,
		ddmFormInstanceRecordVersion);
	inOrder.verify(
		ddmFormInstanceRecord, Mockito.times(1)
	).getDDMFormValues();
	inOrder.verify(
		ddmFormInstanceRecordExporterImpl, Mockito.times(1)
	).getDDMFormFieldValue(
		Matchers.any(DDMFormField.class), Matchers.anyMap(),
		Matchers.any(Locale.class)
	);
	inOrder.verify(
		ddmFormInstanceRecord, Mockito.times(1)
	).getFormInstanceRecordVersion();
	inOrder.verify(
		ddmFormInstanceRecordVersion, Mockito.times(1)
	).getStatus();
	inOrder.verify(
		ddmFormInstanceRecordExporterImpl, Mockito.times(1)
	).getStatusMessage(
		Matchers.anyInt(), Matchers.any(Locale.class)
	);
	inOrder.verify(
		ddmFormInstanceRecordVersion, Mockito.times(1)
	).getStatusDate();
}