### Question:
SubPipelineExecutor { public Optional<Result> execute( List<RowMetaAndData> rows ) throws HopException { if ( rows.isEmpty() || stopped ) { return Optional.empty(); } IPipelineEngine<PipelineMeta> subPipeline = this.createSubPipeline(); running.add( subPipeline ); parentPipeline.addActiveSubPipeline( subPipelineName, subPipeline ); passParametersToPipeline( subPipeline, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subPipeline.setPreviousResult( result ); subPipeline.prepareExecution(); List<RowMetaAndData> rowMetaAndData = new ArrayList<>(); subPipeline.getComponents().stream() .filter( c -> c.getName().equalsIgnoreCase( subTransform ) ) .findFirst() .ifPresent( c -> c.addRowListener( new RowAdapter() { @Override public void rowWrittenEvent( IRowMeta rowMeta, Object[] row ) { rowMetaAndData.add( new RowMetaAndData( rowMeta, row ) ); } } ) ); subPipeline.startThreads(); subPipeline.waitUntilFinished(); updateStatuses( subPipeline ); running.remove( subPipeline ); Result subpipelineResult = subPipeline.getResult(); subpipelineResult.setRows( rowMetaAndData ); return Optional.of( subpipelineResult ); } SubPipelineExecutor( String subPipelineName, IPipelineEngine<PipelineMeta> parentPipeline, PipelineMeta subPipelineMeta, boolean shareVariables,
                              PipelineExecutorParameters parameters, String subTransform, PipelineRunConfiguration runConfiguration ); Optional<Result> execute( List<RowMetaAndData> rows ); void stop(); Map<String, TransformStatus> getStatuses(); IPipelineEngine<PipelineMeta> getParentPipeline(); Set<IPipelineEngine<PipelineMeta>> getRunning(); void setRunning( Set<IPipelineEngine<PipelineMeta>> running );  }### Answer:
@Test public void testRunningZeroRowsIsEmptyOptional() throws Exception { SubPipelineExecutor subPipelineExecutor = new SubPipelineExecutor( "sub-pipeline-name", null, null, false, null, "", null ); Optional<Result> execute = subPipelineExecutor.execute( Collections.emptyList() ); assertFalse( execute.isPresent() ); }