### Question:
SimpleMapping extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { if ( getData().wasStarted ) { if ( !getData().mappingTrans.isFinished() ) { getData().mappingTrans.waitUntilFinished(); } getTrans().removeActiveSubTransformation( getStepname() ); if ( getData().mappingTrans.getErrors() > 0 ) { logError( BaseMessages.getString( PKG, "SimpleMapping.Log.ErrorOccurredInSubTransformation" ) ); setErrors( 1 ); } } super.dispose( smi, sdi ); } SimpleMapping( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void prepareMappingExecution(); static void addInputRenames( List<MappingValueRename> renameList, List<MappingValueRename> addRenameList ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); void stopRunning( StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface ); void stopAll(); Trans getMappingTrans(); void addRowListener( RowListener rowListener ); SimpleMappingData getData();  }### Answer:
@Test public void testDispose() throws KettleException { when( stepMockHelper.trans.getErrors() ).thenReturn( 0 ); when( stepMockHelper.trans.isFinished() ).thenReturn( Boolean.FALSE ); simpleMpData.wasStarted = true; smp = new SimpleMapping( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); smp.init( stepMockHelper.initStepMetaInterface, simpleMpData ); smp.dispose( stepMockHelper.processRowsStepMetaInterface, simpleMpData ); verify( stepMockHelper.trans, times( 1 ) ).isFinished(); verify( stepMockHelper.trans, times( 1 ) ).waitUntilFinished(); verify( stepMockHelper.trans, times( 1 ) ).removeActiveSubTransformation( anyString() ); }