@Test public void nonsensicalBucketingConfiguration() throws ConfigException { try { TrendingConfiguration.builder() .dateField(fieldPathNormaliser.normaliseFieldPath(ParametricValuesService.AUTN_DATE_FIELD)) .numberOfValues(10) .defaultNumberOfBuckets(20) .maxNumberOfBuckets(10) .minNumberOfBuckets(15) .build() .basicValidate(null); fail("Exception should have been thrown"); } catch(final ConfigException e) { assertThat("Exception has the correct message", e.getMessage(), containsString("Default number of buckets must lie between max and min")); } }
@Override public void basicValidate(final String configSection) throws ConfigException { if (dateField == null || dateField.getNormalisedPath().isEmpty()) { throw new ConfigException(configSection, "dateField must be provided"); } validateInteger(defaultNumberOfBuckets, "Default number of buckets"); validateInteger(minNumberOfBuckets, "Minimum number of buckets"); validateInteger(maxNumberOfBuckets, "Maximum number of buckets"); validateInteger(numberOfValues, "Number of values"); if (maxNumberOfBuckets < defaultNumberOfBuckets || minNumberOfBuckets > defaultNumberOfBuckets) { throw new ConfigException(configSection, "Default number of buckets must lie between max and min"); } }
TrendingConfiguration extends SimpleComponent<TrendingConfiguration> { @Override public void basicValidate(final String configSection) throws ConfigException { if (dateField == null || dateField.getNormalisedPath().isEmpty()) { throw new ConfigException(configSection, "dateField must be provided"); } validateInteger(defaultNumberOfBuckets, "Default number of buckets"); validateInteger(minNumberOfBuckets, "Minimum number of buckets"); validateInteger(maxNumberOfBuckets, "Maximum number of buckets"); validateInteger(numberOfValues, "Number of values"); if (maxNumberOfBuckets < defaultNumberOfBuckets || minNumberOfBuckets > defaultNumberOfBuckets) { throw new ConfigException(configSection, "Default number of buckets must lie between max and min"); } } }
TrendingConfiguration extends SimpleComponent<TrendingConfiguration> { @Override public void basicValidate(final String configSection) throws ConfigException { if (dateField == null || dateField.getNormalisedPath().isEmpty()) { throw new ConfigException(configSection, "dateField must be provided"); } validateInteger(defaultNumberOfBuckets, "Default number of buckets"); validateInteger(minNumberOfBuckets, "Minimum number of buckets"); validateInteger(maxNumberOfBuckets, "Maximum number of buckets"); validateInteger(numberOfValues, "Number of values"); if (maxNumberOfBuckets < defaultNumberOfBuckets || minNumberOfBuckets > defaultNumberOfBuckets) { throw new ConfigException(configSection, "Default number of buckets must lie between max and min"); } }  }
TrendingConfiguration extends SimpleComponent<TrendingConfiguration> { @Override public void basicValidate(final String configSection) throws ConfigException { if (dateField == null || dateField.getNormalisedPath().isEmpty()) { throw new ConfigException(configSection, "dateField must be provided"); } validateInteger(defaultNumberOfBuckets, "Default number of buckets"); validateInteger(minNumberOfBuckets, "Minimum number of buckets"); validateInteger(maxNumberOfBuckets, "Maximum number of buckets"); validateInteger(numberOfValues, "Number of values"); if (maxNumberOfBuckets < defaultNumberOfBuckets || minNumberOfBuckets > defaultNumberOfBuckets) { throw new ConfigException(configSection, "Default number of buckets must lie between max and min"); } }  @Override void basicValidate(final String configSection); }
TrendingConfiguration extends SimpleComponent<TrendingConfiguration> { @Override public void basicValidate(final String configSection) throws ConfigException { if (dateField == null || dateField.getNormalisedPath().isEmpty()) { throw new ConfigException(configSection, "dateField must be provided"); } validateInteger(defaultNumberOfBuckets, "Default number of buckets"); validateInteger(minNumberOfBuckets, "Minimum number of buckets"); validateInteger(maxNumberOfBuckets, "Maximum number of buckets"); validateInteger(numberOfValues, "Number of values"); if (maxNumberOfBuckets < defaultNumberOfBuckets || minNumberOfBuckets > defaultNumberOfBuckets) { throw new ConfigException(configSection, "Default number of buckets must lie between max and min"); } }  @Override void basicValidate(final String configSection);  }