SQLDataSetEditWorkflow extends DataSetEditWorkflow<SQLDataSetDef, SQLDataSetDefEditor> { @Override protected void afterFlush() { super.afterFlush(); if ( editor.isUsingQuery() ) { dataSetDef.setDbTable( null ); } else { dataSetDef.setDbSQL( null ); } } @Inject  SQLDataSetEditWorkflow( final DataSetClientServices clientServices,
                                   final DataSetValidatorProvider validatorProvider,
                                   final SyncBeanManager beanManager,
                                   final Event<SaveRequestEvent> saveRequestEvent,
                                   final Event<TestDataSetRequestEvent> testDataSetEvent,
                                   final Event<CancelRequestEvent> cancelRequestEvent,
                                   final View view );   }
@Test public void testFlushDriverUsingQuery() throws Exception { presenter._setDataSetDef( dataSetDef ); presenter.driver = driver; presenter.editor = sqlEditor; when( sqlEditor.isUsingQuery() ).thenReturn( true ); presenter.afterFlush(); verify( dataSetDef, times( 1 ) ).setDbTable( null ); verify( dataSetDef, times( 0 ) ).setDbSQL( null ); }
@Test public void testFlushDriverUsingTable() throws Exception { presenter._setDataSetDef( dataSetDef ); presenter.driver = driver; presenter.editor = sqlEditor; when( sqlEditor.isUsingQuery() ).thenReturn( false ); presenter.afterFlush(); verify( dataSetDef, times( 1 ) ).setDbSQL( null ); verify( dataSetDef, times( 0 ) ).setDbTable( null ); }