DataSetBasicAttributesWorkflow extends DataSetEditorWorkflow<T> { public DataSetEditorWorkflow basicAttributesEdition() { checkDataSetDefNotNull(); dataSetDefBasicAttributesDriver = beanManager.lookupBean(DataSetDefBasicAttributesDriver.class).newInstance(); dataSetDefBasicAttributesDriver.initialize(basicAttributesEditor); dataSetDefBasicAttributesDriver.edit(getDataSetDef()); driver = beanManager.lookupBean( getDriverClass() ).newInstance(); editor = beanManager.lookupBean( getEditorClass() ).newInstance(); driver.initialize(editor); driver.edit(getDataSetDef()); this.flushCommand = new Command() { @Override public void execute() { flush(dataSetDefBasicAttributesDriver); flush(driver); } }; this.stepValidator = new Command() { @Override public void execute() { Iterable<ConstraintViolation<?>> basicAttsViolations = validatorProvider.validateBasicAttributes(getDataSetDef()); dataSetDefBasicAttributesDriver.setConstraintViolations(basicAttsViolations); addViolations(basicAttsViolations); Iterable<ConstraintViolation<?>> violations = validate(); driver.setConstraintViolations(violations); addViolations(violations); } }; view.clearView(); view.add(basicAttributesEditor.asWidget()); view.add(((IsWidget) editor)); return this; } @Inject  DataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,
                                          final DataSetValidatorProvider validatorProvider,
                                          final SyncBeanManager beanManager,
                                          final DataSetDefBasicAttributesEditor basicAttributesEditor,
                                          final Event<SaveRequestEvent> saveRequestEvent,
                                          final Event<TestDataSetRequestEvent> testDataSetEvent,
                                          final Event<CancelRequestEvent> cancelRequestEvent,
                                          final View view); @PostConstruct void init(); DataSetBasicAttributesWorkflow edit(final T def); DataSetEditorWorkflow basicAttributesEdition();  }
@Test public void testBasicAttributesEdition() { DataSetDef def = mock( DataSetDef.class ); presenter.edit( def ).basicAttributesEdition(); verify( beanManager, times( 2 ) ).lookupBean( DataSetDefBasicAttributesDriver.class ); verify( dataSetDefBasicAttributesDriver, times( 2 ) ).initialize( basicAttributesEditor ); verify( dataSetDefBasicAttributesDriver, times( 2 ) ).edit( def ); verify( view, times( 2 ) ).clearView(); verify( view, times( 2 ) ).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(); }