CSVDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<CSVDataSetDef, CSVDataSetDefAttributesEditor> { @Override protected Iterable<ConstraintViolation<?>> validate() { return validatorProvider.validateAttributes( getDataSetDef(), editor.isUsingFilePath() ); } @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 testValidateUsingFilePath() { presenter._setDataSetDef( dataSetDef ); presenter.editor = csvDataSetDefAttributesEditor; when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( true ); presenter.validate(); verify( csvDataSetDefValidator, times( 1 ) ).validateCustomAttributes( dataSetDef, true ); verify( csvDataSetDefValidator, times( 0 ) ).validate( any( CSVDataSetDef.class ), anyBoolean(), anyBoolean(), anyBoolean() ); }
@Test public void testValidateUsingFileUrl() { presenter._setDataSetDef( dataSetDef ); presenter.editor = csvDataSetDefAttributesEditor; when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( false ); presenter.validate(); verify( csvDataSetDefValidator, times( 1 ) ).validateCustomAttributes( dataSetDef, false ); verify( csvDataSetDefValidator, times( 0 ) ).validate( any( CSVDataSetDef.class ), anyBoolean(), anyBoolean(), anyBoolean() ); }