### Question:
Abort extends BaseTransform<AbortMeta, AbortData> implements ITransform<AbortMeta, AbortData> { @Override public boolean processRow() throws HopException { Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } else { putRow( getInputRowMeta(), r ); nrInputRows++; if ( nrInputRows > nrThresholdRows ) { String abortOptionMessage = BaseMessages.getString( PKG, "AbortDialog.Options.Abort.Label"); if ( meta.isAbortWithError() ) { abortOptionMessage = BaseMessages.getString( PKG, "AbortDialog.Options.AbortWithError.Label"); } else if ( meta.isSafeStop() ) { abortOptionMessage = BaseMessages.getString( PKG, "AbortDialog.Options.SafeStop.Label"); } logError( BaseMessages.getString( PKG, "Abort.Log.Wrote.AbortRow", Long.toString( nrInputRows ), abortOptionMessage, getInputRowMeta().getString( r ) ) ); String message = environmentSubstitute( meta.getMessage() ); if ( message == null || message.length() == 0 ) { logError( BaseMessages.getString( PKG, "Abort.Log.DefaultAbortMessage", "" + nrInputRows ) ); } else { logError( message ); } if ( meta.isAbortWithError() ) { setErrors( 1 ); } stopAll(); } else { if ( meta.isAlwaysLogRows() ) { logMinimal( BaseMessages.getString( PKG, "Abort.Log.Wrote.Row", Long.toString( nrInputRows ), getInputRowMeta().getString( r ) ) ); } else { if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "Abort.Log.Wrote.Row", Long.toString( nrInputRows ), getInputRowMeta().getString( r ) ) ); } } } } return true; } Abort( TransformMeta transformMeta, AbortMeta meta, AbortData data, int copyNr, PipelineMeta pipelineMeta,
                Pipeline pipeline ); @Override boolean init(); @Override boolean processRow();  }### Answer:
@Test public void testAbortDoesntAbortWithoutInputRow() throws HopException { Abort abort = new Abort( transformMockHelper.transformMeta, transformMockHelper.iTransformMeta, transformMockHelper.iTransformData, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); abort.processRow(); abort.addRowSetToInputRowSets( transformMockHelper.getMockInputRowSet() ); assertFalse( abort.isStopped() ); abort.processRow(); verify( transformMockHelper.pipeline, never() ).stopAll(); assertFalse( abort.isStopped() ); }
@Test public void testAbortAbortsWithInputRow() throws HopException { Abort abort = new Abort( transformMockHelper.transformMeta, transformMockHelper.iTransformMeta, transformMockHelper.iTransformData, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); abort.processRow(); abort.addRowSetToInputRowSets( transformMockHelper.getMockInputRowSet( new Object[] {} ) ); assertFalse( abort.isStopped() ); abort.processRow(); verify( transformMockHelper.pipeline, times( 1 ) ).stopAll(); assertTrue( abort.isStopped() ); }
@Test public void testAbortWithError() throws HopException { Abort abort = new Abort( transformMockHelper.transformMeta, transformMockHelper.iTransformMeta, transformMockHelper.iTransformData, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); when( transformMockHelper.iTransformMeta.isSafeStop() ).thenReturn( false ); when( transformMockHelper.iTransformMeta.isAbortWithError() ).thenReturn( true ); abort.processRow(); abort.addRowSetToInputRowSets( transformMockHelper.getMockInputRowSet( new Object[] {} ) ); abort.processRow(); assertEquals( 1L, abort.getErrors() ); verify( transformMockHelper.pipeline ).stopAll(); }