MetricsConfig { public Set<What> serverMetrics() { return enabledMetrics; } @Inject  MetricsConfig(Config config); DurationThresholdConfig durationThresholdConfig(); Set<What> serverMetrics(); Set<Integer> precreateCodes(); int reservoirTtl();  }
@Test public void shouldEnableMetricsIfConfigured() throws Exception { Config config = ConfigFactory.parseString( "metrics.server: [REQUEST_PAYLOAD_SIZE, ENDPOINT_REQUEST_DURATION, ENDPOINT_REQUEST_RATE]"); assertThat(new MetricsConfig(config).serverMetrics(), is(EnumSet.of(REQUEST_PAYLOAD_SIZE, ENDPOINT_REQUEST_DURATION, ENDPOINT_REQUEST_RATE))); }
@Test public void shouldReturnDefaultIfNoConfig() throws Exception { assertThat(new MetricsConfig(ConfigFactory.empty()).serverMetrics(), is(MetricsConfig.DEFAULT_ENABLED_METRICS)); }