@Test public void fromShouldThrowOnNegativeGracePeriod() throws Exception { XMLConfiguration xmlConfiguration = FileConfigurationProvider.getConfig(toStream( "<configuration><gracePeriod>-12 ms</gracePeriod></configuration>")); assertThatThrownBy(() -> QuotaMailingListenerConfiguration.from(xmlConfiguration)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Duration amount should be positive"); }
public static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config) { return builder() .addThresholds(readThresholds(config)) .subjectTemplate(readSubjectTemplate(config)) .bodyTemplate(readBodyTemplate(config)) .gracePeriod(readGracePeriod(config)) .name(readName(config)) .build(); }
QuotaMailingListenerConfiguration { public static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config) { return builder() .addThresholds(readThresholds(config)) .subjectTemplate(readSubjectTemplate(config)) .bodyTemplate(readBodyTemplate(config)) .gracePeriod(readGracePeriod(config)) .name(readName(config)) .build(); } }
QuotaMailingListenerConfiguration { public static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config) { return builder() .addThresholds(readThresholds(config)) .subjectTemplate(readSubjectTemplate(config)) .bodyTemplate(readBodyTemplate(config)) .gracePeriod(readGracePeriod(config)) .name(readName(config)) .build(); } private  QuotaMailingListenerConfiguration(ImmutableMap<QuotaThreshold, RenderingInformation> toRenderingInformation,
                                              QuotaThresholds thresholds, Duration gracePeriod, Optional<String> bodyTemplate, Optional<String> subjectTemplate, String name); }
QuotaMailingListenerConfiguration { public static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config) { return builder() .addThresholds(readThresholds(config)) .subjectTemplate(readSubjectTemplate(config)) .bodyTemplate(readBodyTemplate(config)) .gracePeriod(readGracePeriod(config)) .name(readName(config)) .build(); } private  QuotaMailingListenerConfiguration(ImmutableMap<QuotaThreshold, RenderingInformation> toRenderingInformation,
                                              QuotaThresholds thresholds, Duration gracePeriod, Optional<String> bodyTemplate, Optional<String> subjectTemplate, String name); static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config); static Builder builder(); static QuotaMailingListenerConfiguration defaultConfiguration(); QuotaThresholds getThresholds(); Duration getGracePeriod(); String getBodyTemplate(QuotaThreshold quotaThreshold); String getSubjectTemplate(QuotaThreshold quotaThreshold); String getName(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); }
QuotaMailingListenerConfiguration { public static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config) { return builder() .addThresholds(readThresholds(config)) .subjectTemplate(readSubjectTemplate(config)) .bodyTemplate(readBodyTemplate(config)) .gracePeriod(readGracePeriod(config)) .name(readName(config)) .build(); } private  QuotaMailingListenerConfiguration(ImmutableMap<QuotaThreshold, RenderingInformation> toRenderingInformation,
                                              QuotaThresholds thresholds, Duration gracePeriod, Optional<String> bodyTemplate, Optional<String> subjectTemplate, String name); static QuotaMailingListenerConfiguration from(HierarchicalConfiguration<ImmutableNode> config); static Builder builder(); static QuotaMailingListenerConfiguration defaultConfiguration(); QuotaThresholds getThresholds(); Duration getGracePeriod(); String getBodyTemplate(QuotaThreshold quotaThreshold); String getSubjectTemplate(QuotaThreshold quotaThreshold); String getName(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static final String DEFAULT_BODY_TEMPLATE; static final String DEFAULT_SUBJECT_TEMPLATE; static final RenderingInformation DEFAULT_RENDERING_INFORMATION; static final Duration DEFAULT_GRACE_PERIOD; }