### Question:
TextFileOutputStepAnalyzer extends ExternalResourceStepAnalyzer<TextFileOutputMeta> { @Override protected Set<StepField> getUsedFields( TextFileOutputMeta meta ) { Set<StepField> usedFields = new HashSet<>(); if ( meta.isFileNameInField() ) { usedFields.addAll( createStepFields( meta.getFileNameField(), getInputs() ) ); } return usedFields; }  @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput(); @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); @Override Set<String> getOutputResourceFields( TextFileOutputMeta meta );  }### Answer:
@Test public void testGetUsedFields_fileNameInField() throws Exception { when( meta.isFileNameInField() ).thenReturn( true ); when( meta.getFileNameField() ).thenReturn( "filename" ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); assertNotNull( usedFields ); assertEquals( 1, usedFields.size() ); }
@Test public void testGetUsedFields_fileDefinedInMeta() throws Exception { when( meta.isFileNameInField() ).thenReturn( false ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); assertNotNull( usedFields ); assertEquals( 0, usedFields.size() ); }