Configuration { @JsonSetter("requestTimeoutSeconds") public void setRequestTimeout(int requestTimeoutSeconds) { if (requestTimeoutSeconds <= 0) { throw new IllegalArgumentException("requestTimeoutSeconds: " + requestTimeoutSeconds + " (expected: > 0)"); } this.requestTimeout = Duration.ofSeconds(requestTimeoutSeconds); } Configuration(); void setMetricsPrefix(String metricsPrefix); @JsonSetter("purgeFilterIntervalMillis") void setPurgeFilterInterval(int purgeFilterIntervalMillis); void setMaxHttpConnections(int maxHttpConnections); void setMaxHttpRequestLength(int maxHttpRequestLength); void setMaxWorkerThreadPoolSize(int maxWorkerThreadPoolSize); @JsonSetter("requestTimeoutSeconds") void setRequestTimeout(int requestTimeoutSeconds); void setIdleTimeoutMillis(int idleTimeoutMillis); void setDefaultExpectedInsertions(int defaultExpectedInsertions); void setDefaultFalsePositiveProbability(double defaultFalsePositiveProbability); @JsonSetter("defaultValidSecondsAfterCreate") void setDefaultValidPeriodAfterCreate(long defaultValidSecondsAfterCreate); void setChannelBufferSizeForFilterPersistence(int channelBufferSizeForFilterPersistence); void setPersistentStorageDirectory(@Nullable String persistentStorageDirectory); void setAllowRecoverFromCorruptedPersistentFile(boolean allowRecoverFromCorruptedPersistentFile); void setChannelOptions(SupportedChannelOptions channelOptions); @JsonProperty("triggerPersistenceCriteria") void setPersistenceCriteria(@Nullable List<TriggerPersistenceCriteria> criteriaList); void setGracefulShutdownQuietPeriodMillis(long gracefulShutdownQuietPeriodMillis); void setGracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis);  }
@Test public void testSetRequestTimeout() { final Configuration c = new Configuration(); assertThatThrownBy(() -> c.setRequestTimeout(-1)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("requestTimeoutSeconds: -1 (expected: > 0)"); assertThatThrownBy(() -> c.setRequestTimeout(0)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("requestTimeoutSeconds: 0 (expected: > 0)"); }