DDMFormInstanceRecordXMLWriter implements DDMFormInstanceRecordWriter { protected void addFieldElements( Element element, Map<String, String> ddmFormFieldsLabel, Map<String, String> ddmFormFieldsValue) { for (Map.Entry<String, String> entry : ddmFormFieldsValue.entrySet()) { addFieldElement( element, ddmFormFieldsLabel.get(entry.getKey()), entry.getValue()); } }  @Override DDMFormInstanceRecordWriterResponse write(
			DDMFormInstanceRecordWriterRequest
				ddmFormInstanceRecordWriterRequest);  }
@Test public void testAddFieldElements() { DDMFormInstanceRecordXMLWriter ddmFormInstanceRecordXMLWriter = mock( DDMFormInstanceRecordXMLWriter.class); Element element = mock(Element.class); Map<String, String> ddmFormFieldsLabel = LinkedHashMapBuilder.put( "field1", "Field 1" ).put( "field2", "Field 2" ).build(); Map<String, String> ddmFormFieldsValue = LinkedHashMapBuilder.put( "field1", "Value 1" ).put( "field2", "Value 2" ).build(); Mockito.doCallRealMethod( ).when( ddmFormInstanceRecordXMLWriter ).addFieldElements( element, ddmFormFieldsLabel, ddmFormFieldsValue ); Mockito.doNothing( ).when( ddmFormInstanceRecordXMLWriter ).addFieldElement( Matchers.any(Element.class), Matchers.anyString(), Matchers.anyString() ); ddmFormInstanceRecordXMLWriter.addFieldElements( element, ddmFormFieldsLabel, ddmFormFieldsValue); InOrder inOrder = Mockito.inOrder(ddmFormInstanceRecordXMLWriter); inOrder.verify( ddmFormInstanceRecordXMLWriter, Mockito.times(1) ).addFieldElement( element, "Field 1", "Value 1" ); inOrder.verify( ddmFormInstanceRecordXMLWriter, Mockito.times(1) ).addFieldElement( element, "Field 2", "Value 2" ); }