Configuration { public void setPersistentStorageDirectory(@Nullable String persistentStorageDirectory) { if (persistentStorageDirectory == null || persistentStorageDirectory.isEmpty()) { persistentStorageDirectory = System.getProperty("user.dir"); if (persistentStorageDirectory == null || persistentStorageDirectory.isEmpty()) { throw new IllegalArgumentException("empty \"persistentStorageDirectory\" config and \"user.dir\" environment property"); } } this.persistentStorageDirectory = persistentStorageDirectory; } 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 testSetPersistentStorageDirectory() { Configuration c = new Configuration(); c.setPersistentStorageDirectory(null); assertThat(Configuration.persistentStorageDirectory()).isEqualTo(System.getProperty("user.dir")); c = new Configuration(); c.setPersistentStorageDirectory(""); assertThat(Configuration.persistentStorageDirectory()).isEqualTo(System.getProperty("user.dir")); }
@Test public void testSetPersistentStorageDirectoryFailed() { final Configuration c = new Configuration(); String userDir = System.getProperty("user.dir"); System.setProperty("user.dir", ""); assertThatThrownBy(() -> c.setPersistentStorageDirectory("")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("empty \"persistentStorageDirectory\" config and \"user.dir\" environment property"); System.setProperty("user.dir", userDir); }