SQLDataSetEditWorkflow extends DataSetEditWorkflow<SQLDataSetDef, SQLDataSetDefEditor> { @Override protected Iterable<ConstraintViolation<?>> validate( boolean isCacheEnabled, boolean isPushEnabled, boolean isRefreshEnabled ) { return validatorProvider.validate( dataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, editor.isUsingQuery() ); } @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 testValidateUsingQuery() { presenter._setDataSetDef( dataSetDef ); presenter.driver = driver; presenter.editor = sqlEditor; when( sqlEditor.isUsingQuery() ).thenReturn( true ); presenter.validate( true, true, true ); verify( sqlDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, true ); verify( sqlDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, true ); }
@Test public void testValidateUsingTable() { presenter._setDataSetDef( dataSetDef ); presenter.driver = driver; presenter.editor = sqlEditor; when( sqlEditor.isUsingQuery() ).thenReturn( false ); presenter.validate( true, true, true ); verify( sqlDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, false ); verify( sqlDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, false ); }