DDMFormInstanceRecordExporterImpl implements DDMFormInstanceRecordExporter { protected String getDDMFormFieldValue( DDMFormField ddmFormField, Map<String, List<DDMFormFieldValue>> ddmFormFieldValueMap, Locale locale) { List<DDMFormFieldValue> ddmFormFieldValues = ddmFormFieldValueMap.get( ddmFormField.getName()); DDMFormFieldValueRenderer ddmFormFieldValueRenderer = ddmFormFieldTypeServicesTracker.getDDMFormFieldValueRenderer( ddmFormField.getType()); Stream<DDMFormFieldValue> stream = ddmFormFieldValues.stream(); return HtmlUtil.render( StringUtil.merge( stream.map( ddmForFieldValue -> ddmFormFieldValueRenderer.render( ddmForFieldValue, locale) ).filter( Validator::isNotNull ).collect( Collectors.toList() ), StringPool.COMMA_AND_SPACE)); }  @Override DDMFormInstanceRecordExporterResponse export(
			DDMFormInstanceRecordExporterRequest
				ddmFormInstanceRecordExporterRequest);  }
@Test public void testGetDDMFormFieldValue() throws Exception { DDMFormInstanceRecordExporterImpl ddmFormInstanceRecordExporterImpl = new DDMFormInstanceRecordExporterImpl(); ddmFormInstanceRecordExporterImpl.ddmFormFieldTypeServicesTracker = _ddmFormFieldTypeServicesTracker; DDMFormFieldValueRenderer ddmFormFieldValueRenderer = mock( DDMFormFieldValueRenderer.class); DDMFormField ddmFormField = new DDMFormField("field1", "text"); List<DDMFormFieldValue> ddmFormFieldValues = new ArrayList<>(); DDMFormFieldValue ddmFormFieldValue = DDMFormValuesTestUtil.createDDMFormFieldValue( "field1", new UnlocalizedValue("value1")); ddmFormFieldValues.add(ddmFormFieldValue); Map<String, List<DDMFormFieldValue>> ddmFormFieldValueMap = HashMapBuilder.<String, List<DDMFormFieldValue>>put( "field1", ddmFormFieldValues ).build(); Locale locale = new Locale("pt", "BR"); when( _ddmFormFieldTypeServicesTracker.getDDMFormFieldValueRenderer( "text") ).thenReturn( ddmFormFieldValueRenderer ); when( ddmFormFieldValueRenderer.render(ddmFormFieldValue, locale) ).thenReturn( "value1" ); when( _html.render("value1") ).thenReturn( "value1" ); String actualValue = ddmFormInstanceRecordExporterImpl.getDDMFormFieldValue( ddmFormField, ddmFormFieldValueMap, locale); Assert.assertEquals("value1", actualValue); Mockito.verify( _ddmFormFieldTypeServicesTracker, Mockito.times(1) ).getDDMFormFieldValueRenderer( "text" ); Mockito.verify( ddmFormFieldValueRenderer, Mockito.times(1) ).render( ddmFormFieldValue, locale ); Mockito.verify( _html, Mockito.times(1) ).render( "value1" ); }