ParameterGenerationOverlay implements DataServiceDialog.OptimizationOverlay { @Override public void apply( DataServiceDialog dialog ) throws KettleException { DataServiceModel dialogModel = dialog.getModel(); TransMeta transMeta = dialogModel.getTransMeta(); ParameterGenerationController controller = factory.createController( dialogModel ); dialog .applyOverlay( this, XUL_OVERLAY ) .addEventHandler( controller ); controller.initBindings( findSupportedSteps( transMeta ).keySet().asList() ); } ParameterGenerationOverlay( ParameterGenerationFactory factory ); @Override double getPriority(); @Override void apply( DataServiceDialog dialog );  }
@Test public void testApply() throws Exception { ParameterGenerationController controller = mock( ParameterGenerationController.class ); XulDomContainer xulDomContainer = mock( XulDomContainer.class ); TransMeta transMeta = mock( TransMeta.class ); StepMeta supportedStep = new StepMeta( "supportedStep", mock( StepMetaInterface.class ) ); when( dialog.getModel() ).thenReturn( model ); when( model.getTransMeta() ).thenReturn( transMeta ); when( transMeta.getSteps() ).thenReturn( ImmutableList.of( supportedStep, mock( StepMeta.class ) ) ); when( factory.supportsStep( supportedStep ) ).thenReturn( true ); when( factory.createController( model ) ).thenReturn( controller ); when( dialog.applyOverlay( same( overlay ), anyString() ) ).thenReturn( xulDomContainer ); overlay.apply( dialog ); verify( xulDomContainer ).addEventHandler( controller ); verify( controller ).initBindings( ImmutableList.of( "supportedStep" ) ); }