@Test
public void testGetDistinctFields() throws Exception {

	DDMFormInstanceRecordExporterImpl ddmFormInstanceRecordExporterImpl =
		mock(DDMFormInstanceRecordExporterImpl.class);
	DDMStructureVersion ddmStructureVersion = mock(
		DDMStructureVersion.class);
	when(
		ddmFormInstanceRecordExporterImpl.getStructureVersions(1L)
	).thenReturn(
		ListUtil.fromArray(ddmStructureVersion)
	);
	DDMFormField ddmFormField1 = new DDMFormField("field1", "text");
	DDMFormField ddmFormField2 = new DDMFormField("field2", "text");
	when(
		ddmFormInstanceRecordExporterImpl.getNontransientDDMFormFieldsMap(
			ddmStructureVersion)
	).thenReturn(
		LinkedHashMapBuilder.<String, DDMFormField>put(
			"field1", ddmFormField1
		).put(
			"field2", ddmFormField2
		).build()
	);
	when(
		ddmFormInstanceRecordExporterImpl.getDistinctFields(1L)
	).thenCallRealMethod();
	Map<String, DDMFormField> distinctFields =
		ddmFormInstanceRecordExporterImpl.getDistinctFields(1);
	Assert.assertEquals(ddmFormField1, distinctFields.get("field1"));
	Assert.assertEquals(ddmFormField2, distinctFields.get("field2"));
	InOrder inOrder = Mockito.inOrder(ddmFormInstanceRecordExporterImpl);
	inOrder.verify(
		ddmFormInstanceRecordExporterImpl, Mockito.times(1)
	).getStructureVersions(
		1
	);
	inOrder.verify(
		ddmFormInstanceRecordExporterImpl, Mockito.times(1)
	).getNontransientDDMFormFieldsMap(
		ddmStructureVersion
	);
}