MetricService extends EndpointService { public List<Metric> getMetrics(List<String> expressions) throws IOException, TokenExpiredException { StringBuilder requestUrl = new StringBuilder(RESOURCE); for (int i = 0; i < expressions.size(); i++) { requestUrl.append(i == 0 ? "?" : "&"); requestUrl.append("expression=").append(expressions.get(i)); } ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl.toString(), null); assertValidResponse(response, requestUrl.toString()); return fromJson(response.getResult(), new TypeReference<List<Metric>>() { }); } MetricService(ArgusHttpClient client); List<Metric> getMetrics(List<String> expressions); PutResult putMetrics(List<Metric> metrics);  }
@Test public void testGetMetrics() throws IOException, TokenExpiredException { try(ArgusService argusService = new ArgusService(getMockedClient("/MetricServiceTest.json"))) { MetricService metricService = argusService.getMetricService(); List<String> expressions = Arrays.asList(new String[] { "-1d:TestScope:TestMetric:TestNamespace{TestTag=TagValue}:sum" }); List<Metric> result = metricService.getMetrics(expressions); List<Metric> expected = Arrays.asList(new Metric[] { _constructMetric() }); assertEquals(expected, result); } }