MetricService extends EndpointService { public PutResult putMetrics(List<Metric> metrics) throws IOException, TokenExpiredException { String requestUrl = COLLECTION_RESOURCE + RESOURCE; ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, requestUrl, metrics); assertValidResponse(response, requestUrl); Map<String, Object> map = fromJson(response.getResult(), new TypeReference<Map<String, Object>>() { }); List<String> errorMessages = (List<String>) map.get("Error Messages"); return new PutResult(String.valueOf(map.get("Success")), String.valueOf(map.get("Errors")), errorMessages); } MetricService(ArgusHttpClient client); List<Metric> getMetrics(List<String> expressions); PutResult putMetrics(List<Metric> metrics);  }
@Test public void testPutMetrics() throws IOException, TokenExpiredException { try(ArgusService argusService = new ArgusService(getMockedClient("/MetricServiceTest.json"))) { MetricService metricService = argusService.getMetricService(); List<Metric> metrics = Arrays.asList(new Metric[] { _constructMetric() }); PutResult result = metricService.putMetrics(metrics); assertEquals(_constructSuccessfulResult(metrics, 0), result); } }