### Question:
AddXml extends BaseTransform<AddXmlMeta, AddXmlData> implements ITransform<AddXmlMeta, AddXmlData> { public boolean processRow() throws HopException { Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getTransformName(), null, null, this, metadataProvider ); data.fieldIndexes = new int[meta.getOutputFields().length]; for ( int i = 0; i < data.fieldIndexes.length; i++ ) { String fieldsName = meta.getOutputFields()[i].getFieldName(); data.fieldIndexes[i] = getInputRowMeta().indexOfValue( fieldsName ); if ( data.fieldIndexes[i] < 0 ) { throw new HopException( BaseMessages.getString( PKG, "AddXML.Exception.FieldNotFound", fieldsName ) ); } } } Document xmldoc = getDomImplentation().createDocument( null, meta.getRootNode(), null ); Element root = xmldoc.getDocumentElement(); for ( int i = 0; i < meta.getOutputFields().length; i++ ) { XmlField outputField = meta.getOutputFields()[i]; String fieldname = outputField.getFieldName(); IValueMeta v = getInputRowMeta().getValueMeta( data.fieldIndexes[i] ); Object valueData = r[data.fieldIndexes[i]]; if ( !meta.isOmitNullValues() || !v.isNull( valueData ) ) { String value = formatField( v, valueData, outputField ); String element = outputField.getElementName(); if ( element == null || element.length() == 0 ) { element = fieldname; } if ( element == null || element.length() == 0 ) { throw new HopException( "XML does not allow empty strings for element names." ); } if ( outputField.isAttribute() ) { String attributeParentName = outputField.getAttributeParentName(); Element node; if ( attributeParentName == null || attributeParentName.length() == 0 ) { node = root; } else { NodeList nodelist = root.getElementsByTagName( attributeParentName ); if ( nodelist.getLength() > 0 ) { node = (Element) nodelist.item( 0 ); } else { node = root; } } node.setAttribute( element, value ); } else { if ( !element.equals( meta.getRootNode() ) ) { Element e = xmldoc.createElement( element ); Node n = xmldoc.createTextNode( value ); e.appendChild( n ); root.appendChild( e ); } else { Node n = xmldoc.createTextNode( value ); root.appendChild( n ); } } } } StringWriter sw = new StringWriter(); DOMSource domSource = new DOMSource( xmldoc ); try { this.getSerializer().transform( domSource, new StreamResult( sw ) ); } catch ( TransformerException e ) { throw new HopException( e ); } catch ( Exception e ) { throw new HopException( e ); } Object[] outputRowData = RowDataUtil.addValueData( r, getInputRowMeta().size(), sw.toString() ); putRow( data.outputRowMeta, outputRowData ); return true; } AddXml(TransformMeta stepMeta,  AddXmlMeta meta, AddXmlData sdi, int copyNr, PipelineMeta tm, Pipeline trans ); boolean processRow(); boolean init(); void dispose(ITransformMeta smi, ITransformData sdi );  }### Answer:
@Test @Ignore public void testProcessRow() throws HopException { AddXml addXML = new AddXml( stepMockHelper.transformMeta, stepMockHelper.iTransformMeta, stepMockHelper.iTransformData, 0, stepMockHelper.pipelineMeta, stepMockHelper.pipeline ); addXML.init( ); addXML.setInputRowSets( asList( createSourceRowSet( "ADDXML_TEST" ) ) ); assertTrue( addXML.processRow( ) ); assertTrue( addXML.getErrors() == 0 ); assertTrue( addXML.getLinesWritten() > 0 ); }