@Test public void testInvalidMetricQuerySource() { try { Map<String, String> invalidMetricSourceSinkConfigMap = new HashMap<>(); invalidMetricSourceSinkConfigMap.put("urlTemplate", "http: invalidMetricSourceSinkConfigMap.put("metric-source", "bad-metric-source"); Config invalidMetricSourceSinkConfig = ConfigFactory.parseMap(invalidMetricSourceSinkConfigMap); Instant fixedInstant = Instant.parse("2020-03-03T05:05:39Z"); MetricQueryService metricQueryService = new MetricQueryService(httpClient); metricQueryService.queryMetricSource(invalidMetricSourceSinkConfig, metricFunctionsSpec, fixedInstant); } catch (IllegalStateException e) { assertTrue(true); } }
public MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec, Instant instant) throws IllegalStateException, MetricQueryServiceException { String metricSourceName = metricSourceSinkConfig.getString(METRIC_SOURCE_KEY); switch (metricSourceName) { case "graphite": return queryGraphite(metricSourceSinkConfig, metricFunctionsSpec, instant); default: throw new IllegalStateException(String.format("Unknown metric source '%s'.", metricSourceName)); } }
MetricQueryService { public MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec, Instant instant) throws IllegalStateException, MetricQueryServiceException { String metricSourceName = metricSourceSinkConfig.getString(METRIC_SOURCE_KEY); switch (metricSourceName) { case "graphite": return queryGraphite(metricSourceSinkConfig, metricFunctionsSpec, instant); default: throw new IllegalStateException(String.format("Unknown metric source '%s'.", metricSourceName)); } } }
MetricQueryService { public MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec, Instant instant) throws IllegalStateException, MetricQueryServiceException { String metricSourceName = metricSourceSinkConfig.getString(METRIC_SOURCE_KEY); switch (metricSourceName) { case "graphite": return queryGraphite(metricSourceSinkConfig, metricFunctionsSpec, instant); default: throw new IllegalStateException(String.format("Unknown metric source '%s'.", metricSourceName)); } } MetricQueryService();  MetricQueryService(HttpClientWrapper httpClientWrapper); }
MetricQueryService { public MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec, Instant instant) throws IllegalStateException, MetricQueryServiceException { String metricSourceName = metricSourceSinkConfig.getString(METRIC_SOURCE_KEY); switch (metricSourceName) { case "graphite": return queryGraphite(metricSourceSinkConfig, metricFunctionsSpec, instant); default: throw new IllegalStateException(String.format("Unknown metric source '%s'.", metricSourceName)); } } MetricQueryService();  MetricQueryService(HttpClientWrapper httpClientWrapper); MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec,
            Instant instant); }
MetricQueryService { public MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec, Instant instant) throws IllegalStateException, MetricQueryServiceException { String metricSourceName = metricSourceSinkConfig.getString(METRIC_SOURCE_KEY); switch (metricSourceName) { case "graphite": return queryGraphite(metricSourceSinkConfig, metricFunctionsSpec, instant); default: throw new IllegalStateException(String.format("Unknown metric source '%s'.", metricSourceName)); } } MetricQueryService();  MetricQueryService(HttpClientWrapper httpClientWrapper); MetricData queryMetricSource(Config metricSourceSinkConfig, MetricFunctionsSpec metricFunctionsSpec,
            Instant instant);  }