MetricsConfig extends MapConfig { public Optional<String> getMetricsSnapshotReporterBlacklist(String name) { return Optional.ofNullable(get(String.format(METRICS_SNAPSHOT_REPORTER_BLACKLIST, name))); } MetricsConfig(Config config); Optional<String> getMetricsFactoryClass(String name); Optional<String> getMetricsSnapshotReporterStream(String name); int getMetricsSnapshotReporterInterval(String name); Optional<String> getMetricsSnapshotReporterBlacklist(String name); List<String> getMetricReporterNames(); boolean getMetricsTimerEnabled(); boolean getMetricsTimerDebugEnabled(); static final String METRICS_REPORTERS; static final String METRICS_REPORTER_FACTORY; static final String METRICS_TIMER_ENABLED; static final String METRICS_TIMER_DEBUG_ENABLED; static final String METRICS_SNAPSHOT_REPORTER_STREAM; static final String METRICS_SNAPSHOT_REPORTER_INTERVAL; static final String METRICS_SNAPSHOT_REPORTER_BLACKLIST; static final String METRICS_SNAPSHOT_REPORTER_NAME_FOR_DIAGNOSTICS; }
@Test public void testGetMetricsSnapshotReporterBlacklist() { String metricsReporterName = "metricReporterName"; String value = "metric0|metric1"; Config config = new MapConfig( ImmutableMap.of(String.format(MetricsConfig.METRICS_SNAPSHOT_REPORTER_BLACKLIST, metricsReporterName), value)); assertEquals(Optional.of(value), new MetricsConfig(config).getMetricsSnapshotReporterBlacklist(metricsReporterName)); assertFalse(value, new MetricsConfig(new MapConfig()).getMetricsSnapshotReporterBlacklist("someName").isPresent()); }