DataSetEditWorkflow extends DataSetEditorWorkflow<T> { public DataSetEditWorkflow edit( final T definition, List<DataColumnDef> allColumns ) { clear(); this.dataSetDef = definition; checkDataSetDefNotNull(); this.driver = beanManager.lookupBean( getDriverClass() ).newInstance(); this.editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize( editor ); editor.setAcceptableValues( allColumns ); driver.edit( definition ); this.flushCommand = () -> flush(DataSetEditWorkflow.this.driver); this.stepValidator = () -> { final boolean isCacheEnabled = definition.isCacheEnabled(); final boolean isPushEnabled = definition.isPushEnabled(); final boolean isRefreshEnabled = definition.getRefreshTime() != null; Iterable<ConstraintViolation<?>> violations = validate( isCacheEnabled, isPushEnabled, isRefreshEnabled ); driver.setConstraintViolations( violations ); addViolations( violations ); }; view.clearView(); view.add( getWidget() ); return this; } @Inject  DataSetEditWorkflow( final DataSetClientServices clientServices,
                                final DataSetValidatorProvider validatorProvider,
                                final SyncBeanManager beanManager,
                                final Event<SaveRequestEvent> saveRequestEvent,
                                final Event<TestDataSetRequestEvent> testDataSetEvent,
                                final Event<CancelRequestEvent> cancelRequestEvent,
                                final View view ); @PostConstruct void init(); DataSetEditWorkflow edit( final T definition, List<DataColumnDef> allColumns ); @Override void dispose(); E getEditor(); DataSetEditorWorkflow showConfigurationTab(); DataSetEditorWorkflow showPreviewTab(); DataSetEditorWorkflow showAdvancedTab();  }
@Test public void testEdit() { List<DataColumnDef> columnDefs = mock( List.class ); presenter.edit( dataSetDef, columnDefs ); assertEquals( editor, presenter.getEditor() ); verify( driver, times( 1 ) ).initialize( editor ); verify( editor, times( 1 ) ).setAcceptableValues( columnDefs ); verify( driver, times( 1 ) ).edit( dataSetDef ); verify( view, times( 2 ) ).clearView(); verify( view, times( 1 ) ).add( any( IsWidget.class ) ); verify( view, times( 0 ) ).init( presenter ); verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) ); verify( view, times( 0 ) ).clearButtons(); }