BeanDataSetDefValidator extends AbstractDataSetDefValidator<BeanDataSetDef> { @Override public Iterable<ConstraintViolation<?>> validate( BeanDataSetDef dataSetDef, boolean isCacheEnabled, boolean isPushEnabled, boolean isRefreshEnabled, Object... params ) { Set<ConstraintViolation<BeanDataSetDef>> _violations = validator.validate( dataSetDef, getValidationGroups( isCacheEnabled, isPushEnabled, isRefreshEnabled, BeanDataSetDefValidation.class ) ); return toIterable( _violations ); } @Inject  BeanDataSetDefValidator( Validator validator ); @Override DataSetProviderType getSupportedProvider(); @Override Iterable<ConstraintViolation<?>> validateCustomAttributes( BeanDataSetDef dataSetDef, Object... params ); @Override Iterable<ConstraintViolation<?>> validate( BeanDataSetDef dataSetDef,
                                                      boolean isCacheEnabled,
                                                      boolean isPushEnabled,
                                                      boolean isRefreshEnabled,
                                                      Object... params );  }
@Test public void testValidate() { final boolean isCacheEnabled = true; final boolean isPushEnabled = true; final boolean isRefreshEnabled = true; tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled); verify(validator, times(1)).validate(beanDataSetDef, DataSetDefBasicAttributesGroup.class, DataSetDefProviderTypeGroup.class, DataSetDefCacheRowsValidation.class, DataSetDefPushSizeValidation.class, DataSetDefRefreshIntervalValidation.class, BeanDataSetDefValidation.class); }
@Test public void testValidateNoCache() { final boolean isCacheEnabled = false; final boolean isPushEnabled = true; final boolean isRefreshEnabled = true; tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled); verify(validator, times(1)).validate(beanDataSetDef, DataSetDefBasicAttributesGroup.class, DataSetDefProviderTypeGroup.class, DataSetDefPushSizeValidation.class, DataSetDefRefreshIntervalValidation.class, BeanDataSetDefValidation.class); }
@Test public void testValidateNoPush() { final boolean isCacheEnabled = true; final boolean isPushEnabled = false; final boolean isRefreshEnabled = true; tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled); verify(validator, times(1)).validate(beanDataSetDef, DataSetDefBasicAttributesGroup.class, DataSetDefProviderTypeGroup.class, DataSetDefCacheRowsValidation.class, DataSetDefRefreshIntervalValidation.class, BeanDataSetDefValidation.class); }
@Test public void testValidateNoRefresh() { final boolean isCacheEnabled = true; final boolean isPushEnabled = true; final boolean isRefreshEnabled = false; tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled); verify(validator, times(1)).validate(beanDataSetDef, DataSetDefBasicAttributesGroup.class, DataSetDefProviderTypeGroup.class, DataSetDefCacheRowsValidation.class, DataSetDefPushSizeValidation.class, BeanDataSetDefValidation.class); }