### Question:
TableOutputStepAnalyzer extends ConnectionExternalResourceStepAnalyzer<TableOutputMeta> { @Override protected Map<String, RowMetaInterface> getOutputRowMetaInterfaces( TableOutputMeta meta ) { String[] nextStepNames = parentTransMeta.getNextStepNames( parentStepMeta ); Map<String, RowMetaInterface> outputRows = new HashMap<>(); RowMetaInterface outputFields = getOutputFields( meta ); if ( outputFields != null && ArrayUtils.isEmpty( nextStepNames ) ) { nextStepNames = new String[] { NONE }; } for ( String stepName : nextStepNames ) { outputRows.put( stepName, outputFields ); } RowMetaInterface tableFields = new RowMeta(); Set<String> outFields = getOutputResourceFields( meta ); for ( String outField : outFields ) { ValueMetaInterface vmi = new ValueMeta( outField ); tableFields.addValueMeta( vmi ); } outputRows.put( RESOURCE, tableFields ); return outputRows; }  @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 testGetOutputRowMetaInterfaces() throws Exception { String[] nextStepNames = new String[] { "nextStep1" }; when( parentTransMeta.getNextStepNames( parentStepMeta ) ).thenReturn( nextStepNames ); RowMetaInterface rmi = mock( RowMetaInterface.class ); doReturn( rmi ).when( analyzer ).getOutputFields( meta ); String[] tableFields = new String[] { "field1", "field2" }; when( meta.getFieldDatabase() ).thenReturn( tableFields ); when( meta.specifyFields() ).thenReturn( true ); Map<String, RowMetaInterface> outputs = analyzer.getOutputRowMetaInterfaces( meta ); assertNotNull( outputs ); assertEquals( 2, outputs.size() ); RowMetaInterface resourceRow = outputs.get( ExternalResourceStepAnalyzer.RESOURCE ); assertNotNull( resourceRow ); assertEquals( 2, resourceRow.size() ); for ( String tableField : tableFields ) { assertNotNull( resourceRow.searchValueMeta( tableField ) ); } assertEquals( rmi, outputs.get( "nextStep1" ) ); when( meta.specifyFields() ).thenReturn( false ); RowMetaInterface rmi2 = Mockito.mock( RowMetaInterface.class ); String[] outputFields = new String[] { "foo" }; when( rmi2.getFieldNames() ).thenReturn( outputFields ); doReturn( rmi2 ).when( analyzer ).getOutputFields( meta ); outputs = analyzer.getOutputRowMetaInterfaces( meta ); assertNotNull( outputs ); assertEquals( 2, outputs.size() ); resourceRow = outputs.get( ExternalResourceStepAnalyzer.RESOURCE ); assertNotNull( resourceRow ); assertEquals( 1, resourceRow.size() ); for ( String outputField : outputFields ) { assertNotNull( resourceRow.searchValueMeta( outputField ) ); } assertEquals( rmi2, outputs.get( "nextStep1" ) ); }