### Question:
ExternalResourceStepAnalyzer extends StepAnalyzer<T> { @Override protected IMetaverseNode createOutputFieldNode( IAnalysisContext context, ValueMetaInterface fieldMeta, String targetStepName, String nodeType ) { nodeType = RESOURCE.equals( targetStepName ) ? getResourceOutputNodeType() : nodeType; return super.createOutputFieldNode( context, fieldMeta, targetStepName, nodeType ); }  boolean hasOutputResource( T meta ); IStepExternalResourceConsumer getExternalResourceConsumer(); void setExternalResourceConsumer( IStepExternalResourceConsumer externalResourceConsumer ); Set<String> getOutputResourceFields( T meta ); abstract IMetaverseNode createResourceNode( IExternalResourceInfo resource ); IMetaverseNode createResourceNode( T meta, IExternalResourceInfo resource ); abstract String getResourceInputNodeType(); abstract String getResourceOutputNodeType(); abstract boolean isOutput(); abstract boolean isInput(); @Override boolean copyState( final IClonableStepAnalyzer newAnalyzer ); static final String RESOURCE; }### Answer:
@Test public void testCreateOutputFieldNode_resource() throws Exception { IAnalysisContext context = mock( IAnalysisContext.class ); doReturn( "thisStepName" ).when( analyzer ).getStepName(); analyzer.rootNode = node; when( node.getLogicalId() ).thenReturn( "logical id" ); ValueMetaInterface vmi = new ValueMeta( "name", 1 ); IMetaverseNode outputFieldNode = analyzer.createOutputFieldNode( context, vmi, ExternalResourceStepAnalyzer.RESOURCE, DictionaryConst.NODE_TYPE_TRANS_FIELD ); assertNotNull( outputFieldNode ); assertNotNull( outputFieldNode.getProperty( DictionaryConst.PROPERTY_KETTLE_TYPE ) ); assertEquals( ExternalResourceStepAnalyzer.RESOURCE, outputFieldNode.getProperty( DictionaryConst.PROPERTY_TARGET_STEP ) ); assertEquals( "OUTPUT_TYPE", outputFieldNode.getType() ); verify( builder ).addNode( outputFieldNode ); }
@Test public void testCreateOutputFieldNode() throws Exception { IAnalysisContext context = mock( IAnalysisContext.class ); doReturn( "thisStepName" ).when( analyzer ).getStepName(); analyzer.rootNode = node; when( node.getLogicalId() ).thenReturn( "logical id" ); ValueMetaInterface vmi = new ValueMeta( "name", 1 ); IMetaverseNode outputFieldNode = analyzer.createOutputFieldNode( context, vmi, "targetStep", DictionaryConst.NODE_TYPE_TRANS_FIELD ); assertNotNull( outputFieldNode ); assertNotNull( outputFieldNode.getProperty( DictionaryConst.PROPERTY_KETTLE_TYPE ) ); assertEquals( "targetStep", outputFieldNode.getProperty( DictionaryConst.PROPERTY_TARGET_STEP ) ); assertEquals( DictionaryConst.NODE_TYPE_TRANS_FIELD, outputFieldNode.getType() ); verify( builder ).addNode( outputFieldNode ); }