### Question:
TransExecutorStepAnalyzer extends StepAnalyzer<TransExecutorMeta> { public void connectToSubTransInputFields( TransMeta subTransMeta, IMetaverseNode subTransNode, IComponentDescriptor descriptor ) { Set<StepField> incomingFields = getInputs().getFieldNames(); for ( StepField field : incomingFields ) { IMetaverseNode inputNode = getInputs().findNode( field ); subtransAnalyzer.linkUsedFieldToSubTrans( inputNode, subTransMeta, subTransNode, descriptor ); } } TransExecutorStepAnalyzer(); void connectToSubTransOutputFields( TransExecutorMeta meta, TransMeta subTransMeta,
                                             IMetaverseNode subTransNode,
                                             IComponentDescriptor descriptor ); void connectToSubTransInputFields( TransMeta subTransMeta,
                                            IMetaverseNode subTransNode,
                                            IComponentDescriptor descriptor ); @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override IClonableStepAnalyzer newInstance(); static final String EXECUTION_RESULTS_TARGET; static final String OUTPUT_ROWS_TARGET; static final String RESULT_FILES_TARGET; }### Answer:
@Test public void testConnectToSubTransInputFields() { IMetaverseNode childTransNode = mock( IMetaverseNode.class ); IMetaverseNode outNode = mock( IMetaverseNode.class ); StepNodes inputs = new StepNodes(); inputs.addNode( "previousStep", "first", outNode ); inputs.addNode( "previousStep", "last", outNode ); doReturn( inputs ).when( spyAnalyzer ).getInputs(); doNothing().when( spyHelper ).linkUsedFieldToSubTrans( any( IMetaverseNode.class ), any( TransMeta.class ), any( IMetaverseNode.class ), any( IComponentDescriptor.class ) ); spyAnalyzer.connectToSubTransInputFields( childTransMeta, childTransNode, descriptor ); verify( spyHelper, times( inputs.getFieldNames().size() ) ).linkUsedFieldToSubTrans( any( IMetaverseNode.class ), any( TransMeta.class ), any( IMetaverseNode.class ), any( IComponentDescriptor.class ) ); }
@Test public void testConnectToSubTransInputFields_noPrevFields() { IMetaverseNode childTransNode = mock( IMetaverseNode.class ); StepNodes inputs = new StepNodes(); doReturn( inputs ).when( spyAnalyzer ).getInputs(); doNothing().when( spyHelper ).linkUsedFieldToSubTrans( any( IMetaverseNode.class ), any( TransMeta.class ), any( IMetaverseNode.class ), any( IComponentDescriptor.class ) ); spyAnalyzer.connectToSubTransInputFields( childTransMeta, childTransNode, descriptor ); verify( spyHelper, never() ).linkUsedFieldToSubTrans( any( IMetaverseNode.class ), any( TransMeta.class ), any( IMetaverseNode.class ), any( IComponentDescriptor.class ) ); }