### Question:
GetXMLDataStepAnalyzer extends ExternalResourceStepAnalyzer<GetXMLDataMeta> { @Override protected Set<StepField> getUsedFields( GetXMLDataMeta meta ) { Set<StepField> usedFields = new HashSet<>(); if ( meta.isInFields() ) { Set<StepField> stepFields = createStepFields( meta.getXMLField(), getInputs() ); usedFields.addAll( stepFields ); } return usedFields; }  @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override Set<ComponentDerivationRecord> getChangeRecords( GetXMLDataMeta meta ); @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput();  }### Answer:
@Test public void testGetUsedFields_xmlNotInField() throws Exception { when( meta.isInFields() ).thenReturn( false ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); assertEquals( 0, usedFields.size() ); }
@Test public void testGetUsedFields() throws Exception { when( meta.isInFields() ).thenReturn( true ); when( meta.getXMLField() ).thenReturn( "xml" ); StepNodes inputs = new StepNodes(); inputs.addNode( "previousStep", "xml", node ); inputs.addNode( "previousStep", "otherField", node ); doReturn( inputs ).when( analyzer ).getInputs(); Set<StepField> usedFields = analyzer.getUsedFields( meta ); assertEquals( 1, usedFields.size() ); assertEquals( "xml", usedFields.iterator().next().getFieldName() ); }