### Question:
Constant extends BaseTransform<ConstantMeta, ConstantData> implements ITransform<ConstantMeta, ConstantData> { @Override public boolean processRow() throws HopException { Object[] r = null; r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( data.firstRow ) { data.firstRow = false; data.outputMeta = getInputRowMeta().clone(); meta.getFields( data.outputMeta, getTransformName(), null, null, this, metadataProvider ); } r = RowDataUtil.addRowData( r, getInputRowMeta().size(), data.getConstants().getData() ); putRow( data.outputMeta, r ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "Constant.Log.Wrote.Row", Long.toString( getLinesWritten() ), getInputRowMeta().getString( r ) ) ); } if ( checkFeedback( getLinesWritten() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "Constant.Log.LineNr", Long.toString( getLinesWritten() ) ) ); } } return true; } Constant( TransformMeta transformMeta, ConstantMeta meta, ConstantData data, int copyNr, PipelineMeta pipelineMeta,
                   Pipeline pipeline ); static final RowMetaAndData buildRow( ConstantMeta meta, ConstantData data,
                                               List<ICheckResult> remarks ); @Override boolean processRow(); @Override boolean init();  }### Answer:
@Test public void testProcessRow_success() throws Exception { doReturn( new Object[ 1 ] ).when( constantSpy ).getRow(); doReturn( new RowMeta() ).when( constantSpy ).getInputRowMeta(); doReturn( new Object[ 1 ] ).when( rowMetaAndData ).getData(); boolean success = constantSpy.processRow(); assertTrue( success ); }
@Test public void testProcessRow_fail() throws Exception { doReturn( null ).when( constantSpy ).getRow(); doReturn( null ).when( constantSpy ).getInputRowMeta(); boolean success = constantSpy.processRow(); assertFalse( success ); }