### Question:
ConnectionExternalResourceStepAnalyzer extends ExternalResourceStepAnalyzer<T> { public void linkResourceToFields( StepNodes stepNodes ) { Set<String> fieldNames = stepNodes.getFieldNames( ExternalResourceStepAnalyzer.RESOURCE ); if ( fieldNames != null ) { for ( String fieldName : fieldNames ) { IMetaverseNode resNode = stepNodes.findNode( ExternalResourceStepAnalyzer.RESOURCE, fieldName ); if ( resNode != null ) { resNode.setProperty( DictionaryConst.PROPERTY_NAMESPACE, getTableNode().getLogicalId() ); getMetaverseBuilder().updateNode( resNode ); getMetaverseBuilder().addLink( getTableNode(), DictionaryConst.LINK_CONTAINS, resNode ); } } } }  @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); IMetaverseNode getConnectionNode(); IMetaverseNode getTableNode(); void linkResourceToFields( StepNodes stepNodes );  }### Answer:
@Test public void testLinkResourceToFields() throws Exception { StepNodes inputs = new StepNodes(); inputs.addNode( "x", "first name", node ); inputs.addNode( ExternalResourceStepAnalyzer.RESOURCE, "first name", node ); inputs.addNode( ExternalResourceStepAnalyzer.RESOURCE, "last name", node ); doReturn( tableNode ).when( analyzer ).getTableNode(); when( tableNode.getLogicalId() ).thenReturn( "table logical id" ); analyzer.linkResourceToFields( inputs ); int resoruceNodeCount = inputs.getFieldNames( ExternalResourceStepAnalyzer.RESOURCE ).size(); verify( node, times( resoruceNodeCount ) ).setProperty( DictionaryConst.PROPERTY_NAMESPACE, "table logical id" ); verify( builder, times( resoruceNodeCount ) ).updateNode( node ); verify( builder, times( resoruceNodeCount ) ).addLink( tableNode, DictionaryConst.LINK_CONTAINS, node ); }