### Question:
HTTPClientStepAnalyzer extends ExternalResourceStepAnalyzer<HTTPMeta> { @Override protected Set<StepField> getUsedFields( HTTPMeta stepMeta ) { Set<StepField> usedFields = new HashSet<>(); if ( stepMeta.isUrlInField() && StringUtils.isNotEmpty( stepMeta.getUrlField() ) ) { usedFields.addAll( createStepFields( stepMeta.getUrlField(), getInputs() ) ); } String[] parameterFields = stepMeta.getArgumentField(); if ( ArrayUtils.isNotEmpty( parameterFields ) ) { for ( String paramField : parameterFields ) { usedFields.addAll( createStepFields( paramField, getInputs() ) ); } } String[] headerFields = stepMeta.getHeaderField(); if ( ArrayUtils.isNotEmpty( headerFields ) ) { for ( String headerField : headerFields ) { usedFields.addAll( createStepFields( headerField, getInputs() ) ); } } return usedFields; }  @Override Set<Class<? extends BaseStepMeta>> getSupportedSteps(); @Override IMetaverseNode createResourceNode( IExternalResourceInfo resource ); @Override String getResourceInputNodeType(); @Override String getResourceOutputNodeType(); @Override boolean isOutput(); @Override boolean isInput(); @Override IClonableStepAnalyzer newInstance();  }### Answer:
@Test public void testGetUsedFields_urlInField() throws Exception { Set<StepField> fields = new HashSet<>(); when( meta.isUrlInField() ).thenReturn( true ); when( meta.getUrlField() ).thenReturn( "url" ); doReturn( stepNodes ).when( analyzer ).getInputs(); doReturn( fields ).when( analyzer ).createStepFields( "url", stepNodes ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); verify( analyzer ).createStepFields( "url", stepNodes ); }
@Test public void testGetUsedFields_urlInFieldNoFieldSet() throws Exception { Set<StepField> fields = new HashSet<>(); when( meta.isUrlInField() ).thenReturn( true ); when( meta.getUrlField() ).thenReturn( null ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); verify( analyzer, never() ).createStepFields( anyString(), any( StepNodes.class ) ); }
@Test public void testGetUsedFields_argumentField() throws Exception { Set<StepField> fields = new HashSet<>(); when( meta.getArgumentField() ).thenReturn( new String[] { "param1", "param2" } ); doReturn( stepNodes ).when( analyzer ).getInputs(); doReturn( fields ).when( analyzer ).createStepFields( anyString(), eq( stepNodes ) ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); verify( analyzer ).createStepFields( "param1", stepNodes ); verify( analyzer ).createStepFields( "param2", stepNodes ); }
@Test public void testGetUsedFields_headerField() throws Exception { Set<StepField> fields = new HashSet<>(); when( meta.getHeaderField() ).thenReturn( new String[] { "header1", "header2" } ); doReturn( stepNodes ).when( analyzer ).getInputs(); doReturn( fields ).when( analyzer ).createStepFields( anyString(), eq( stepNodes ) ); Set<StepField> usedFields = analyzer.getUsedFields( meta ); verify( analyzer ).createStepFields( "header1", stepNodes ); verify( analyzer ).createStepFields( "header2", stepNodes ); }