CSVDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<CSVDataSetDef, CSVDataSetDefAttributesEditor> { @Override protected void afterFlush() { super.afterFlush(); if ( !editor.isUsingFilePath() ) { dataSetDef.setFilePath( null ); } else { dataSetDef.setFileURL( null ); } } @Inject  CSVDataSetBasicAttributesWorkflow( 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 );   }
@Test public void testFlushDriverUsingFilePath() throws Exception { presenter._setDataSetDef( dataSetDef ); presenter.editor = csvDataSetDefAttributesEditor; when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( true ); presenter.afterFlush(); verify( dataSetDef, times( 1 ) ).setFileURL( null ); verify( dataSetDef, times( 0 ) ).setFilePath( null ); }
@Test public void testFlushDriverUsingFileUrl() throws Exception { presenter._setDataSetDef( dataSetDef ); presenter.editor = csvDataSetDefAttributesEditor; when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( false ); presenter.afterFlush(); verify( dataSetDef, times( 1 ) ).setFilePath( null ); verify( dataSetDef, times( 0 ) ).setFileURL( null ); }