BatchService extends EndpointService { public BigInteger createBatch(List<String> expressions, int ttl) throws IOException, TokenExpiredException { StringBuilder requestUrl = new StringBuilder(METRIC_RESOURCE).append("/batch?"); expressions.stream().forEach((expression) -> { requestUrl.append("expression=").append(expression); }); requestUrl.append("&ttl=").append(ttl); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl.toString(), null); assertValidResponse(response, requestUrl.toString()); Map<String, String> result = fromJson(response.getResult(), new TypeReference<Map<String, String>>() { }); return new BigInteger(result.get("id")); } BatchService(ArgusHttpClient client); BigInteger createBatch(List<String> expressions, int ttl); void deleteBatch(BigInteger batchId); Batch getBatch(BigInteger batchId); Map<String, String> getBatches();  }
@Test public void testCreateBatch() throws IOException, TokenExpiredException { try(ArgusService argusService = new ArgusService(getMockedClient("/BatchServiceTest.json"))) { BatchService batchService = argusService.getBatchService(); BigInteger id = batchService.createBatch(Arrays.asList(new String[] { "-1d:TestScope:TestMetric{TestTag=TagValue}:avg" }), 3600); assertEquals(BigInteger.ONE, id); } }