### Question:
TableOutputStepAnalyzer extends ConnectionExternalResourceStepAnalyzer<TableOutputMeta> { @Override protected IMetaverseNode createTableNode( IExternalResourceInfo resource ) throws MetaverseAnalyzerException { BaseDatabaseResourceInfo resourceInfo = (BaseDatabaseResourceInfo) resource; Object obj = resourceInfo.getAttributes().get( DictionaryConst.PROPERTY_TABLE ); String tableName = obj == null ? null : parentTransMeta.environmentSubstitute( obj.toString() ); obj = resourceInfo.getAttributes().get( DictionaryConst.PROPERTY_SCHEMA ); String schema = obj == null ? null : obj.toString(); MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor( tableName, DictionaryConst.NODE_TYPE_DATA_TABLE, getConnectionNode(), getDescriptor().getContext() ); IMetaverseNode tableNode = createNodeFromDescriptor( componentDescriptor ); tableNode.setProperty( DictionaryConst.PROPERTY_NAMESPACE, componentDescriptor.getNamespace().getNamespaceId() ); tableNode.setProperty( DictionaryConst.PROPERTY_TABLE, tableName ); tableNode.setProperty( DictionaryConst.PROPERTY_SCHEMA, schema ); tableNode.setLogicalIdGenerator( DictionaryConst.LOGICAL_ID_GENERATOR_DB_TABLE ); return tableNode; }  @Override Set<String> getOutputResourceFields( TableOutputMeta meta ); @Override Set<ComponentDerivationRecord> getChangeRecords( TableOutputMeta meta ); @Override IMetaverseNode getConnectionNode(); @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput(); static final String TRUNCATE_TABLE; }### Answer:
@Test public void testCreateTableNode() throws Exception { IConnectionAnalyzer connectionAnalyzer = mock( IConnectionAnalyzer.class ); doReturn( connectionAnalyzer ).when( analyzer ).getConnectionAnalyzer(); IMetaverseNode connNode = mock( IMetaverseNode.class ); when( connectionAnalyzer.analyze( any( IComponentDescriptor.class ), anyObject() ) ).thenReturn( connNode ); BaseDatabaseResourceInfo resourceInfo = mock( BaseDatabaseResourceInfo.class ); Map<Object, Object> attributes = new HashMap<>(); attributes.put( DictionaryConst.PROPERTY_TABLE, TABLE_NAME ); attributes.put( DictionaryConst.PROPERTY_SCHEMA, "schemaName" ); when( resourceInfo.getAttributes() ).thenReturn( attributes ); IMetaverseNode connectionNode = mock( IMetaverseNode.class ); doReturn( connectionNode ).when( analyzer ).getConnectionNode(); when( connectionNode.getLogicalId() ).thenReturn( "CONNECTION_ID" ); IMetaverseNode resourceNode = analyzer.createTableNode( resourceInfo ); assertEquals( TABLE_NAME, resourceNode.getProperty( DictionaryConst.PROPERTY_TABLE ) ); assertEquals( TABLE_NAME, resourceNode.getName() ); assertEquals( "schemaName", resourceNode.getProperty( DictionaryConst.PROPERTY_SCHEMA ) ); assertEquals( "CONNECTION_ID", resourceNode.getProperty( DictionaryConst.PROPERTY_NAMESPACE ) ); }