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