SQLDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<SQLDataSetDef, SQLDataSetDefAttributesEditor> { @Override protected Iterable<ConstraintViolation<?>> validate() { return validatorProvider.validateAttributes( getDataSetDef(), editor.isUsingQuery() ); } @Inject  SQLDataSetBasicAttributesWorkflow( 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 testValidateUsingQuery() { presenter._setDataSetDef( dataSetDef ); presenter.editor = sqlDataSetDefAttributesEditor; when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( true ); presenter.validate(); verify( sqlDataSetDefValidator, times( 1 ) ).validateCustomAttributes( any( SQLDataSetDef.class ), eq( true ) ); verify( sqlDataSetDefValidator, times( 0 ) ).validate( any( SQLDataSetDef.class ), anyBoolean(), anyBoolean(), anyBoolean() ); }
@Test public void testValidateUsingTable() { presenter._setDataSetDef( dataSetDef ); presenter.editor = sqlDataSetDefAttributesEditor; when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( false ); presenter.validate(); verify( sqlDataSetDefValidator, times( 1 ) ).validateCustomAttributes( any( SQLDataSetDef.class ), eq( false ) ); verify( sqlDataSetDefValidator, times( 0 ) ).validate( any( SQLDataSetDef.class ), anyBoolean(), anyBoolean(), anyBoolean() ); }